From 6e67e73346e7b3fff50a61147c9e1dd2808add43 Mon Sep 17 00:00:00 2001 From: n0izn0iz Date: Mon, 16 Dec 2024 21:07:37 +0100 Subject: [PATCH 01/20] feat: allow to make article proposal (#1456) Signed-off-by: Norman Meier Co-authored-by: WaDadidou --- .../socialFeed/RichText/RichText.tsx | 3 ++- .../socialFeed/RichText/RichText.type.ts | 1 + .../socialFeed/RichText/RichText.web.tsx | 3 ++- .../FeedNewArticle/FeedNewArticleScreen.tsx | 20 ++++++++++++++++--- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/packages/components/socialFeed/RichText/RichText.tsx b/packages/components/socialFeed/RichText/RichText.tsx index 3a22576129..03c655dae8 100644 --- a/packages/components/socialFeed/RichText/RichText.tsx +++ b/packages/components/socialFeed/RichText/RichText.tsx @@ -28,6 +28,7 @@ export const RichText: React.FC = ({ loading, isPostConsultation, initialValue, + publishText = "Publish", }) => { const { width: windowWidth, height: windowHeight } = useWindowDimensions(); const richText = useRef(null); @@ -93,7 +94,7 @@ export const RichText: React.FC = ({ disabled={publishDisabled} isLoading={loading} loader - text="Publish" + text={publishText} size="M" /> diff --git a/packages/components/socialFeed/RichText/RichText.type.ts b/packages/components/socialFeed/RichText/RichText.type.ts index 45c0f7cabc..ad5074f768 100644 --- a/packages/components/socialFeed/RichText/RichText.type.ts +++ b/packages/components/socialFeed/RichText/RichText.type.ts @@ -35,4 +35,5 @@ export interface RichTextProps { postId: string; setIsMapShown?: Dispatch>; hasLocation?: boolean; + publishText?: string; } diff --git a/packages/components/socialFeed/RichText/RichText.web.tsx b/packages/components/socialFeed/RichText/RichText.web.tsx index aec69b760c..c6e0ae17bd 100644 --- a/packages/components/socialFeed/RichText/RichText.web.tsx +++ b/packages/components/socialFeed/RichText/RichText.web.tsx @@ -139,6 +139,7 @@ export const RichText: React.FC = ({ loading, publishDisabled, authorId, + publishText = "Publish", postId, setIsMapShown, hasLocation, @@ -514,7 +515,7 @@ export const RichText: React.FC = ({ disabled={publishDisabled} loader isLoading={loading} - text="Publish" + text={publishText} size="M" onPress={handlePublish} /> diff --git a/packages/screens/FeedNewArticle/FeedNewArticleScreen.tsx b/packages/screens/FeedNewArticle/FeedNewArticleScreen.tsx index 61eaec0dfc..03ac700048 100644 --- a/packages/screens/FeedNewArticle/FeedNewArticleScreen.tsx +++ b/packages/screens/FeedNewArticle/FeedNewArticleScreen.tsx @@ -11,8 +11,8 @@ import { BrandText } from "@/components/BrandText"; import { SVG } from "@/components/SVG"; import { ScreenContainer } from "@/components/ScreenContainer"; import { ScreenTitle } from "@/components/ScreenContainer/ScreenTitle"; -import { WalletStatusBox } from "@/components/WalletStatusBox"; import { TertiaryBox } from "@/components/boxes/TertiaryBox"; +import { DAOSelector } from "@/components/dao/DAOSelector"; import { Label, TextInputCustom } from "@/components/inputs/TextInputCustom"; import { FileUploader } from "@/components/inputs/fileUploader"; import { FeedPostingProgressBar } from "@/components/loaders/FeedPostingProgressBar"; @@ -60,8 +60,9 @@ export const FeedNewArticleScreen: ScreenFC<"FeedNewArticle"> = () => { const isMobile = useIsMobile(); const wallet = useSelectedWallet(); const selectedNetworkId = useSelectedNetworkId(); - const userId = wallet?.userId; const userIPFSKey = useSelector(selectNFTStorageAPI); + const [selectedDaoId, setSelectedDAOId] = useState(); + const userId = selectedDaoId || wallet?.userId; const { uploadFilesToPinata, ipfsUploadProgress } = useIpfs(); const [isUploadLoading, setIsUploadLoading] = useState(false); const [isProgressBarShown, setIsProgressBarShown] = useState(false); @@ -233,6 +234,13 @@ export const FeedNewArticleScreen: ScreenFC<"FeedNewArticle"> = () => { scrollViewRef.current?.scrollToEnd(); }, [step, isLoading]); + // Reset DAOSelector when the user selects another wallet + const [daoSelectorKey, setDaoSelectorKey] = useState(0); + useEffect(() => { + setSelectedDAOId(undefined); + setDaoSelectorKey((key) => key + 1); + }, [wallet]); + // // OpenGraph URL preview // useEffect(() => { // addedUrls.forEach(url => { @@ -265,7 +273,12 @@ export const FeedNewArticleScreen: ScreenFC<"FeedNewArticle"> = () => { alignSelf: "center", }} > - + = () => { !formValues.shortDescription || !wallet } + publishText={selectedDaoId ? "Propose" : "Publish"} onPublish={onPublish} authorId={userId || ""} postId="" From c5afb2f1ae199045bae1a25fcd866fd0d5266fc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=B9=96=DB=A3=DB=9CDadidou?= <50441633+WaDadidou@users.noreply.github.com> Date: Tue, 17 Dec 2024 04:09:44 -0500 Subject: [PATCH 02/20] fix: Show the asterix in "regular" required TextInputCustom (#1457) --- packages/components/inputs/TextInputCustom.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/components/inputs/TextInputCustom.tsx b/packages/components/inputs/TextInputCustom.tsx index 696611b060..c473ba95fd 100644 --- a/packages/components/inputs/TextInputCustom.tsx +++ b/packages/components/inputs/TextInputCustom.tsx @@ -287,6 +287,20 @@ export const TextInputCustom = ({ style={[styles.labelText, fontMedium10, labelStyle]} > {label} + {rules?.required && ( + + * + + )} From b43cbe8be55deff1e02910e48c47ef9cab079435 Mon Sep 17 00:00:00 2001 From: clegirar <33428384+clegirar@users.noreply.github.com> Date: Wed, 18 Dec 2024 08:38:18 +0100 Subject: [PATCH 03/20] feat(feed): take maximum width (#1447) Signed-off-by: clegirar Co-authored-by: Mikael VALLENET --- .../socialFeed/NewsFeed/NewsFeed.tsx | 40 +++++++++---------- .../socialFeed/NewsFeed/NewsFeedInput.tsx | 4 +- packages/hooks/useMaxResolution.ts | 11 +++-- packages/screens/Feed/FeedScreen.tsx | 4 +- .../screens/Feed/components/FeedHeader.tsx | 2 +- 5 files changed, 29 insertions(+), 32 deletions(-) diff --git a/packages/components/socialFeed/NewsFeed/NewsFeed.tsx b/packages/components/socialFeed/NewsFeed/NewsFeed.tsx index d37a4d73e3..53a9b42a77 100644 --- a/packages/components/socialFeed/NewsFeed/NewsFeed.tsx +++ b/packages/components/socialFeed/NewsFeed/NewsFeed.tsx @@ -23,19 +23,15 @@ import { useFetchFeed, } from "../../../hooks/feed/useFetchFeed"; import { useIsMobile } from "../../../hooks/useIsMobile"; -import { useMaxResolution } from "../../../hooks/useMaxResolution"; import useSelectedWallet from "../../../hooks/useSelectedWallet"; -import { - layout, - RESPONSIVE_BREAKPOINT_S, - screenContentMaxWidth, -} from "../../../utils/style/layout"; +import { layout, RESPONSIVE_BREAKPOINT_S } from "../../../utils/style/layout"; import { PostCategory } from "../../../utils/types/feed"; import { SpacerColumn, SpacerRow } from "../../spacer"; import { SocialArticleCard } from "../SocialCard/cards/SocialArticleCard"; import { SocialThreadCard } from "../SocialCard/cards/SocialThreadCard"; import { SocialVideoCard } from "../SocialCard/cards/SocialVideoCard"; +import { useMaxResolution } from "@/hooks/useMaxResolution"; import { DeepPartial } from "@/utils/typescript"; const OFFSET_Y_LIMIT_FLOATING = 224; @@ -63,7 +59,7 @@ export const NewsFeed: React.FC = ({ }) => { const isMobile = useIsMobile(); const { width: windowWidth } = useWindowDimensions(); - const { width } = useMaxResolution(); + const { width } = useMaxResolution({ isLarge: true }); const selectedWallet = useSelectedWallet(); const reqWithQueryUser = { ...req, queryUserId: selectedWallet?.userId }; const { data, isFetching, refetch, hasNextPage, fetchNextPage, isLoading } = @@ -179,7 +175,6 @@ export const NewsFeed: React.FC = ({ {post.category === PostCategory.Article ? ( @@ -210,21 +205,21 @@ export const NewsFeed: React.FC = ({ [windowWidth, width, isFlagged, refetch, cardStyle], ); + // We have to keep the first fragment here to don't have a loop of re-renders return ( <> RenderItem(post)} - ListHeaderComponentStyle={{ - zIndex: 1, - width: windowWidth, - maxWidth: screenContentMaxWidth, - }} + ListHeaderComponentStyle={{ zIndex: 1 }} ListHeaderComponent={ <>
@@ -233,7 +228,17 @@ export const NewsFeed: React.FC = ({ } keyExtractor={(post) => post.id} onScroll={scrollHandler} - contentContainerStyle={contentCStyle} + contentContainerStyle={ + isMobile + ? { + alignItems: "center", + width: "100%", + } + : { + alignSelf: "center", + width, + } + } onEndReachedThreshold={4} onEndReached={onEndReached} /> @@ -262,11 +267,6 @@ export const NewsFeed: React.FC = ({ ); }; -const contentCStyle: ViewStyle = { - alignItems: "center", - alignSelf: "center", - width: "100%", -}; const floatingActionsCStyle: ViewStyle = { position: "absolute", justifyContent: "center", diff --git a/packages/components/socialFeed/NewsFeed/NewsFeedInput.tsx b/packages/components/socialFeed/NewsFeed/NewsFeedInput.tsx index d38a6e4428..19d1119b1c 100644 --- a/packages/components/socialFeed/NewsFeed/NewsFeedInput.tsx +++ b/packages/components/socialFeed/NewsFeed/NewsFeedInput.tsx @@ -38,7 +38,6 @@ import { useWalletControl } from "@/context/WalletControlProvider"; import { useFeedPosting } from "@/hooks/feed/useFeedPosting"; import { useAppMode } from "@/hooks/useAppMode"; import { useIpfs } from "@/hooks/useIpfs"; -import { useMaxResolution } from "@/hooks/useMaxResolution"; import { useSelectedNetworkInfo } from "@/hooks/useSelectedNetwork"; import useSelectedWallet from "@/hooks/useSelectedWallet"; import { NetworkFeature, getNetworkFeature } from "@/networks"; @@ -133,7 +132,6 @@ export const NewsFeedInput = React.forwardRef< ) => { const [appMode] = useAppMode(); const { width: windowWidth } = useWindowDimensions(); - const { width } = useMaxResolution(); const [viewWidth, setViewWidth] = useState(0); const { uploadFilesToPinata, ipfsUploadProgress } = useIpfs(); const inputMaxHeight = 400; @@ -355,7 +353,7 @@ export const NewsFeedInput = React.forwardRef< return ( setViewWidth(e.nativeEvent.layout.width)} > {isMapShown && ( diff --git a/packages/hooks/useMaxResolution.ts b/packages/hooks/useMaxResolution.ts index 1616903856..1539f06fa5 100644 --- a/packages/hooks/useMaxResolution.ts +++ b/packages/hooks/useMaxResolution.ts @@ -3,7 +3,6 @@ import { useWindowDimensions } from "react-native"; import { useIsMobile } from "./useIsMobile"; -import { useSidebar } from "@/context/SidebarProvider"; import { fullSidebarWidth, getMobileScreenContainerMarginHorizontal, @@ -13,7 +12,6 @@ import { screenContainerContentMarginHorizontal, screenContentMaxWidth, screenContentMaxWidthLarge, - smallSidebarWidth, } from "@/utils/style/layout"; export const useMaxResolution = ({ @@ -22,12 +20,13 @@ export const useMaxResolution = ({ isLarge = false, } = {}) => { const { width: windowWidth, height: windowHeight } = useWindowDimensions(); - const { isSidebarExpanded } = useSidebar(); const isMobile = useIsMobile(); + + // If we have a different width when sidebar is expanded and when it's not, the sidebar will be laggy on certain screens (like FeedScreen) + // So this calcul find the bigger width to have the same width no matter the sidebar state const contentWidth = useMemo( - () => - windowWidth - (isSidebarExpanded ? fullSidebarWidth : smallSidebarWidth), - [windowWidth, isSidebarExpanded], + () => windowWidth - fullSidebarWidth, + [windowWidth], ); const width = useMemo(() => { diff --git a/packages/screens/Feed/FeedScreen.tsx b/packages/screens/Feed/FeedScreen.tsx index fb240a9ca1..86687188ce 100644 --- a/packages/screens/Feed/FeedScreen.tsx +++ b/packages/screens/Feed/FeedScreen.tsx @@ -75,9 +75,9 @@ export const FeedScreen: ScreenFC<"Feed"> = ({ return ( } forceNetworkFeatures={[NetworkFeature.SocialFeed]} headerChildren={Social Feed} diff --git a/packages/screens/Feed/components/FeedHeader.tsx b/packages/screens/Feed/components/FeedHeader.tsx index 813d777ef7..78f8c77934 100644 --- a/packages/screens/Feed/components/FeedHeader.tsx +++ b/packages/screens/Feed/components/FeedHeader.tsx @@ -23,8 +23,8 @@ type FeedHeaderProps = { }; export const FeedHeader: React.FC = ({ selectedTab }) => { - const { width } = useMaxResolution(); const navigation = useAppNavigation(); + const { width } = useMaxResolution({ isLarge: true }); const selectedNetworkInfo = useSelectedNetworkInfo(); const selectedNetworkKind = selectedNetworkInfo?.kind; const selectedWallet = useSelectedWallet(); From 88ca6f38382184be9c305fdb3d0a24e258c445ae Mon Sep 17 00:00:00 2001 From: clegirar <33428384+clegirar@users.noreply.github.com> Date: Wed, 18 Dec 2024 14:35:24 +0100 Subject: [PATCH 04/20] fix: font weight in music feed screen (#1459) Signed-off-by: clegirar --- packages/components/inputs/TextInputCustom.tsx | 10 +++++----- packages/components/modals/ModalBase.tsx | 10 ++++++++-- packages/components/music/FeedMusicList.tsx | 4 ++-- packages/components/music/TrackCard.tsx | 8 ++++---- packages/components/music/TrackOptionsButton.tsx | 14 +++++++++++--- packages/components/music/UploadMusicButton.tsx | 5 ++--- .../music/UploadMusicModal/UploadTrack.tsx | 16 ++++------------ packages/components/socialFeed/FeedFeeText.tsx | 4 ++-- packages/utils/style/fonts.ts | 7 +++++++ 9 files changed, 45 insertions(+), 33 deletions(-) diff --git a/packages/components/inputs/TextInputCustom.tsx b/packages/components/inputs/TextInputCustom.tsx index c473ba95fd..d0c7489d31 100644 --- a/packages/components/inputs/TextInputCustom.tsx +++ b/packages/components/inputs/TextInputCustom.tsx @@ -40,7 +40,7 @@ import { neutralA3, secondaryColor, } from "../../utils/style/colors"; -import { fontMedium10, fontSemibold14 } from "../../utils/style/fonts"; +import { fontRegular10, fontRegular14 } from "../../utils/style/fonts"; import { layout } from "../../utils/style/layout"; import { BrandText } from "../BrandText"; import { ErrorText } from "../ErrorText"; @@ -100,7 +100,7 @@ export const Label: React.FC<{ @@ -284,14 +284,14 @@ export const TextInputCustom = ({ (variant !== "labelOutside" && !hideLabel && ( <> {label} {rules?.required && ( = ({ {!!label && ( - + {label} )} diff --git a/packages/components/music/FeedMusicList.tsx b/packages/components/music/FeedMusicList.tsx index f769d1113c..a3674a9545 100644 --- a/packages/components/music/FeedMusicList.tsx +++ b/packages/components/music/FeedMusicList.tsx @@ -15,7 +15,7 @@ import { useAppMode } from "../../hooks/useAppMode"; import useSelectedWallet from "../../hooks/useSelectedWallet"; import { NetworkFeature } from "../../networks"; import { zodTryParseJSON } from "../../utils/sanitize"; -import { fontSemibold20 } from "../../utils/style/fonts"; +import { fontRegular20 } from "../../utils/style/fonts"; import { layout } from "../../utils/style/layout"; import { PostCategory, @@ -108,7 +108,7 @@ export const FeedMusicList: React.FC<{ return ( - {title} + {title} {allowUpload && } diff --git a/packages/components/music/TrackCard.tsx b/packages/components/music/TrackCard.tsx index af139ef2b5..cf881690a6 100644 --- a/packages/components/music/TrackCard.tsx +++ b/packages/components/music/TrackCard.tsx @@ -30,7 +30,7 @@ import { neutralFF, primaryColor, } from "@/utils/style/colors"; -import { fontMedium13, fontSemibold14 } from "@/utils/style/fonts"; +import { fontRegular13, fontRegular14 } from "@/utils/style/fonts"; import { layout } from "@/utils/style/layout"; import { ZodSocialFeedTrackMetadata } from "@/utils/types/feed"; import { Media } from "@/utils/types/mediaPlayer"; @@ -124,7 +124,7 @@ export const TrackCard: React.FC<{ )} - + {track?.title || ""} @@ -176,11 +176,11 @@ const positionButtonBoxStyle: ViewStyle = { }; const contentDescriptionStyle: TextStyle = { - ...fontMedium13, + ...fontRegular13, color: neutral77, }; const contentNameStyle: TextStyle = { - ...fontSemibold14, + ...fontRegular14, color: primaryColor, }; diff --git a/packages/components/music/TrackOptionsButton.tsx b/packages/components/music/TrackOptionsButton.tsx index 182f0e1964..b26948d83e 100644 --- a/packages/components/music/TrackOptionsButton.tsx +++ b/packages/components/music/TrackOptionsButton.tsx @@ -12,6 +12,7 @@ import { SpacerColumn } from "../spacer"; import { Post } from "@/api/feed/v1/feed"; import ThreeDotsCircleWhite from "@/assets/icons/music/three-dot-circle-white.svg"; import { useAppMode } from "@/hooks/useAppMode"; +import { fontRegular16, fontRegular20 } from "@/utils/style/fonts"; import { layout } from "@/utils/style/layout"; const BUTTONS_HEIGHT = 28; @@ -29,7 +30,14 @@ export const TrackOptionsButton: FC<{ }; const TrackOptionModalHeader = () => { - return {trackName}; + return ( + + {trackName} + + ); }; return ( @@ -70,7 +78,7 @@ export const TrackOptionsButton: FC<{ alignItems: "center", }} > - Share + Share - Tip + Tip = ({ onUploadDone }) => { - + Provide FLAC, WAV or AIFF for highest audio quality. @@ -357,7 +350,7 @@ const buttonContainerStyle: ViewStyle = { // marginBottom: layout.spacing_x2, }; const buttonTextStyle: TextStyle = { - ...fontSemibold14, + ...fontRegular14, color: primaryColor, }; const divideLineStyle: ViewStyle = { @@ -374,8 +367,7 @@ const footerBottomCStyle: ViewStyle = { marginBottom: layout.spacing_x2, }; const footerTextStyle: TextStyle = { - ...fontSemibold14, - + ...fontRegular14, color: neutral77, }; const inputBoxStyle: ViewStyle = { diff --git a/packages/components/socialFeed/FeedFeeText.tsx b/packages/components/socialFeed/FeedFeeText.tsx index 4b2b2e21a8..d34fc2af28 100644 --- a/packages/components/socialFeed/FeedFeeText.tsx +++ b/packages/components/socialFeed/FeedFeeText.tsx @@ -3,7 +3,7 @@ import { StyleProp, TextStyle, View, ViewStyle } from "react-native"; import { useFeedPosting } from "../../hooks/feed/useFeedPosting"; import { useTheme } from "../../hooks/useTheme"; import { errorColor, neutral77 } from "../../utils/style/colors"; -import { fontSemibold14 } from "../../utils/style/fonts"; +import { fontRegular14 } from "../../utils/style/fonts"; import { PostCategory } from "../../utils/types/feed"; import { BrandText } from "../BrandText"; @@ -45,6 +45,6 @@ export const FeedFeeText: React.FC<{ }; const testCStyle: TextStyle = { - ...fontSemibold14, + ...fontRegular14, color: neutral77, }; diff --git a/packages/utils/style/fonts.ts b/packages/utils/style/fonts.ts index 163b4f5940..c994a365be 100644 --- a/packages/utils/style/fonts.ts +++ b/packages/utils/style/fonts.ts @@ -264,3 +264,10 @@ export const fontRegular12: TextStyle = { fontFamily: "Exo_400Regular", fontWeight: "400", }; +export const fontRegular10: TextStyle = { + fontSize: 10, + letterSpacing: -(10 * 0.02), + lineHeight: 12, + fontFamily: "Exo_400Regular", + fontWeight: "400", +}; From 5359170e8bc6b24f6ca11c5726d370985dc0983b Mon Sep 17 00:00:00 2001 From: clegirar <33428384+clegirar@users.noreply.github.com> Date: Thu, 19 Dec 2024 16:47:57 +0100 Subject: [PATCH 05/20] feat: change font weight in video feed screen (#1460) Signed-off-by: clegirar --- packages/components/mini/SelectPicture.tsx | 4 ++-- packages/components/video/FeedVideosList.tsx | 4 ++-- .../components/video/UploadVideoButton.tsx | 4 ++-- .../components/video/UploadVideoModal.tsx | 17 +++++--------- packages/components/video/VideoCard.tsx | 22 +++++-------------- 5 files changed, 17 insertions(+), 34 deletions(-) diff --git a/packages/components/mini/SelectPicture.tsx b/packages/components/mini/SelectPicture.tsx index 183fbc5f20..c6b59b517e 100644 --- a/packages/components/mini/SelectPicture.tsx +++ b/packages/components/mini/SelectPicture.tsx @@ -10,7 +10,7 @@ import { SVG } from "@/components/SVG"; import { CustomPressable } from "@/components/buttons/CustomPressable"; import { IMAGE_MIME_TYPES } from "@/utils/mime"; import { neutral33 } from "@/utils/style/colors"; -import { fontSemibold14 } from "@/utils/style/fonts"; +import { fontRegular14 } from "@/utils/style/fonts"; import { layout } from "@/utils/style/layout"; import { LocalFileData } from "@/utils/types/files"; @@ -107,7 +107,7 @@ export const SelectPicture = ({ > {squareSelectorOptions.placeholder && ( - + {squareSelectorOptions.placeholder} )} diff --git a/packages/components/video/FeedVideosList.tsx b/packages/components/video/FeedVideosList.tsx index 86c5ebf59f..eadf4faf7e 100644 --- a/packages/components/video/FeedVideosList.tsx +++ b/packages/components/video/FeedVideosList.tsx @@ -14,7 +14,7 @@ import { useAppMode } from "../../hooks/useAppMode"; import useSelectedWallet from "../../hooks/useSelectedWallet"; import { NetworkFeature } from "../../networks"; import { zodTryParseJSON } from "../../utils/sanitize"; -import { fontSemibold20 } from "../../utils/style/fonts"; +import { fontRegular20 } from "../../utils/style/fonts"; import { layout } from "../../utils/style/layout"; import { ZodSocialFeedVideoMetadata } from "../../utils/types/feed"; import { BrandText } from "../BrandText"; @@ -93,7 +93,7 @@ export const FeedVideosList: React.FC<{ return ( - + {title} diff --git a/packages/components/video/UploadVideoButton.tsx b/packages/components/video/UploadVideoButton.tsx index d379ab0e92..e2e8af12a6 100644 --- a/packages/components/video/UploadVideoButton.tsx +++ b/packages/components/video/UploadVideoButton.tsx @@ -3,7 +3,7 @@ import { TextStyle, TouchableOpacity, ViewStyle } from "react-native"; import Upload from "../../../assets/icons/upload_alt.svg"; import { neutral30, primaryColor } from "../../utils/style/colors"; -import { fontSemibold14 } from "../../utils/style/fonts"; +import { fontRegular14 } from "../../utils/style/fonts"; import { layout } from "../../utils/style/layout"; import { BrandText } from "../BrandText"; import { SVG } from "../SVG"; @@ -31,7 +31,7 @@ const buttonContainerStyle: ViewStyle = { borderRadius: 999, }; const buttonTextStyle: TextStyle = { - ...fontSemibold14, + ...fontRegular14, color: primaryColor, }; diff --git a/packages/components/video/UploadVideoModal.tsx b/packages/components/video/UploadVideoModal.tsx index 3690abd5a0..4bb0446977 100644 --- a/packages/components/video/UploadVideoModal.tsx +++ b/packages/components/video/UploadVideoModal.tsx @@ -30,7 +30,7 @@ import { primaryColor, secondaryColor, } from "../../utils/style/colors"; -import { fontSemibold14 } from "../../utils/style/fonts"; +import { fontRegular14, fontSemibold14 } from "../../utils/style/fonts"; import { layout } from "../../utils/style/layout"; import { CustomLatLngExpression, @@ -274,7 +274,7 @@ export const UploadVideoModal: FC<{ - + Video Thumbnail @@ -434,14 +434,7 @@ export const UploadVideoModal: FC<{ - + Provide 2k video for highest video quality. @@ -506,7 +499,7 @@ const buttonContainerStyle: ViewStyle = { backgroundColor: neutral30, }; const buttonTextStyle: TextStyle = { - ...fontSemibold14, + ...fontRegular14, color: primaryColor, }; const imgStyle: ImageStyle = { @@ -527,7 +520,7 @@ const footerStyle: ViewStyle = { paddingVertical: layout.spacing_x2, }; const footerTextStyle: TextStyle = { - ...fontSemibold14, + ...fontRegular14, color: neutral77, width: "55%", diff --git a/packages/components/video/VideoCard.tsx b/packages/components/video/VideoCard.tsx index 04bac4fdd6..4a723f6966 100644 --- a/packages/components/video/VideoCard.tsx +++ b/packages/components/video/VideoCard.tsx @@ -23,11 +23,7 @@ import { neutralFF, withAlpha, } from "../../utils/style/colors"; -import { - fontMedium13, - fontSemibold13, - fontSemibold14, -} from "../../utils/style/fonts"; +import { fontRegular13, fontRegular14 } from "../../utils/style/fonts"; import { layout, RESPONSIVE_BREAKPOINT_S } from "../../utils/style/layout"; import { tinyAddress } from "../../utils/text"; import { ZodSocialFeedVideoMetadata } from "../../utils/types/feed"; @@ -74,7 +70,7 @@ export const VideoCard: React.FC<{ if (!video) return ( - + Video not found ); @@ -117,7 +113,7 @@ export const VideoCard: React.FC<{ /> - + {prettyMediaDuration(video.videoFile.videoMetadata?.duration)} @@ -139,7 +135,7 @@ export const VideoCard: React.FC<{ - + {video?.title.trim()} @@ -147,13 +143,7 @@ export const VideoCard: React.FC<{ <> {video?.description?.trim()} @@ -231,5 +221,5 @@ const positionButtonBoxStyle: ViewStyle = { }; const contentNameStyle: TextStyle = { - ...fontSemibold14, + ...fontRegular14, }; From 0088374ceba132546f3b88d0d995e6c2ddce8bdd Mon Sep 17 00:00:00 2001 From: clegirar <33428384+clegirar@users.noreply.github.com> Date: Thu, 19 Dec 2024 20:41:45 +0100 Subject: [PATCH 06/20] fix: fullWidth for all feed screens (#1463) Signed-off-by: clegirar --- packages/screens/Feed/components/MapFeed.tsx | 9 ++------- packages/screens/Feed/components/MusicFeed.tsx | 8 ++------ packages/screens/Feed/components/VideosFeed.tsx | 8 ++------ 3 files changed, 6 insertions(+), 19 deletions(-) diff --git a/packages/screens/Feed/components/MapFeed.tsx b/packages/screens/Feed/components/MapFeed.tsx index 60a2d1507c..e60e827fd9 100644 --- a/packages/screens/Feed/components/MapFeed.tsx +++ b/packages/screens/Feed/components/MapFeed.tsx @@ -7,17 +7,13 @@ import { MobileTitle } from "@/components/ScreenContainer/ScreenContainerMobile" import { Map } from "@/components/socialFeed/Map"; import { useIsMobile } from "@/hooks/useIsMobile"; import { useMaxResolution } from "@/hooks/useMaxResolution"; -import { - headerHeight, - RESPONSIVE_BREAKPOINT_S, - screenContentMaxWidth, -} from "@/utils/style/layout"; +import { headerHeight, RESPONSIVE_BREAKPOINT_S } from "@/utils/style/layout"; export const MapFeed: FC<{ consultedPostId?: string; }> = ({ consultedPostId }) => { const { height: windowHeight, width: windowWidth } = useWindowDimensions(); - const { width, height } = useMaxResolution(); + const { width, height } = useMaxResolution({ isLarge: true }); const isMobile = useIsMobile(); return ( @@ -29,7 +25,6 @@ export const MapFeed: FC<{ style={{ height: windowHeight - (headerHeight + 110), width: windowWidth < RESPONSIVE_BREAKPOINT_S ? windowWidth : width, - maxWidth: screenContentMaxWidth, }} consultedPostId={consultedPostId} /> diff --git a/packages/screens/Feed/components/MusicFeed.tsx b/packages/screens/Feed/components/MusicFeed.tsx index 89f1c15216..3d1ed5cb05 100644 --- a/packages/screens/Feed/components/MusicFeed.tsx +++ b/packages/screens/Feed/components/MusicFeed.tsx @@ -8,14 +8,11 @@ import { FeedMusicList } from "@/components/music/FeedMusicList"; import { useIsMobile } from "@/hooks/useIsMobile"; import { useMaxResolution } from "@/hooks/useMaxResolution"; import { useSelectedNetworkId } from "@/hooks/useSelectedNetwork"; -import { - RESPONSIVE_BREAKPOINT_S, - screenContentMaxWidth, -} from "@/utils/style/layout"; +import { RESPONSIVE_BREAKPOINT_S } from "@/utils/style/layout"; export const MusicFeed: FC = () => { const { width: windowWidth } = useWindowDimensions(); - const { width, height } = useMaxResolution(); + const { width, height } = useMaxResolution({ isLarge: true }); const isMobile = useIsMobile(); const selectedNetworkId = useSelectedNetworkId(); return ( @@ -30,7 +27,6 @@ export const MusicFeed: FC = () => { style={{ alignSelf: "center", width: windowWidth < RESPONSIVE_BREAKPOINT_S ? windowWidth : width, - maxWidth: screenContentMaxWidth, }} /> diff --git a/packages/screens/Feed/components/VideosFeed.tsx b/packages/screens/Feed/components/VideosFeed.tsx index dc58c04aff..bf673dc592 100644 --- a/packages/screens/Feed/components/VideosFeed.tsx +++ b/packages/screens/Feed/components/VideosFeed.tsx @@ -9,15 +9,12 @@ import { FeedVideosList } from "@/components/video/FeedVideosList"; import { useIsMobile } from "@/hooks/useIsMobile"; import { useMaxResolution } from "@/hooks/useMaxResolution"; import { useSelectedNetworkId } from "@/hooks/useSelectedNetwork"; -import { - RESPONSIVE_BREAKPOINT_S, - screenContentMaxWidth, -} from "@/utils/style/layout"; +import { RESPONSIVE_BREAKPOINT_S } from "@/utils/style/layout"; import { PostCategory } from "@/utils/types/feed"; export const VideosFeed: FC = () => { const { width: windowWidth } = useWindowDimensions(); - const { width, height } = useMaxResolution(); + const { width, height } = useMaxResolution({ isLarge: true }); const isMobile = useIsMobile(); const selectedNetworkId = useSelectedNetworkId(); @@ -50,7 +47,6 @@ export const VideosFeed: FC = () => { style={{ alignSelf: "center", width: windowWidth < RESPONSIVE_BREAKPOINT_S ? windowWidth : width, - maxWidth: screenContentMaxWidth, }} /> From af0c1e7733e8298b66c9bc4c8aeb1d06773110df Mon Sep 17 00:00:00 2001 From: Mikael VALLENET Date: Fri, 20 Dec 2024 12:41:32 +0100 Subject: [PATCH 07/20] chore: fix CI e2e test (#1464) --- cypress/e2e/gno/lib.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/gno/lib.ts b/cypress/e2e/gno/lib.ts index 0183052533..983d82cb0d 100644 --- a/cypress/e2e/gno/lib.ts +++ b/cypress/e2e/gno/lib.ts @@ -21,12 +21,14 @@ export const resetChain = () => { export const connectWallet = () => { // NOTE: Wait a little bit to ensure that Connect wallet exist and clickable - cy.wait(500); + cy.wait(2000); cy.contains("Connect wallet").click({ force: true }); cy.get("div[data-testid=connect-gnotest-wallet]", { timeout: 5_000, - }).click({ force: true }); + }) + .should("exist") + .click({ force: true }); cy.contains("Connect wallet").should("not.exist"); }; From f53046e4d181379f43b02d80349e76c1aad8cb66 Mon Sep 17 00:00:00 2001 From: n0izn0iz Date: Fri, 20 Dec 2024 14:58:57 +0100 Subject: [PATCH 08/20] feat: upgrade gno version (#1462) Signed-off-by: Norman Meier Co-authored-by: MikaelVallenet --- .gnoversion | 2 +- gno/p/dao_core/gno.mod | 6 -- gno/p/dao_interfaces/gno.mod | 5 - gno/p/dao_proposal_single/gno.mod | 8 -- gno/p/dao_roles_group/gno.mod | 7 -- gno/p/dao_utils/gno.mod | 5 - gno/p/dao_voting_group/gno.mod | 7 -- gno/p/flags_index/gno.mod | 2 - gno/p/havl/gno.mod | 2 - gno/p/jsonutil/gno.mod | 7 -- gno/p/jsonutil/jsonutil.gno | 16 --- gno/p/role_manager/gno.mod | 6 -- gno/p/ujson/gno.mod | 6 -- gno/r/cockpit/gno.mod | 8 -- gno/r/dao_realm/gno.mod | 15 --- gno/r/dao_registry/gno.mod | 8 -- gno/r/launchpad_grc20/airdrop_grc20.gno | 6 +- gno/r/launchpad_grc20/airdrop_grc20_test.gno | 4 +- gno/r/launchpad_grc20/gno.mod | 12 --- gno/r/launchpad_grc20/render.gno | 36 +++---- gno/r/launchpad_grc20/sale_grc20.gno | 11 ++- gno/r/launchpad_grc20/sale_grc20_test.gno | 95 ++++++++++-------- gno/r/launchpad_grc20/token_factory_grc20.gno | 39 ++++---- .../token_factory_grc20_test.gno | 24 ++--- gno/r/projects_manager/gno.mod | 8 -- gno/r/social_feeds/feeds_test.gno | 3 +- gno/r/social_feeds/gno.mod | 11 --- gno/r/tori/gno.mod | 10 -- gno/r/tori/messages.gno | 31 +++--- gno/r/tori/tori.gno | 99 +++++++++---------- .../context/WalletsProvider/gnotest/index.tsx | 10 +- .../Projects/hooks/useEscrowContract.ts | 4 +- packages/utils/gno.ts | 4 +- packages/utils/gnodao/deploy.ts | 2 +- 34 files changed, 187 insertions(+), 332 deletions(-) diff --git a/.gnoversion b/.gnoversion index ddef93042d..af62af00c7 100644 --- a/.gnoversion +++ b/.gnoversion @@ -1 +1 @@ -9786fa366f922f04e1251ec6f1df6423b4fd2bf4 +c8cd8f4b6ccbe9f4ee5622032228553496186d51 diff --git a/gno/p/dao_core/gno.mod b/gno/p/dao_core/gno.mod index 7dd48bc44d..294b6efaa3 100644 --- a/gno/p/dao_core/gno.mod +++ b/gno/p/dao_core/gno.mod @@ -1,7 +1 @@ module gno.land/p/teritori/dao_core - -require ( - gno.land/p/demo/json v0.0.0-latest - gno.land/p/teritori/dao_interfaces v0.0.0-latest - gno.land/p/teritori/jsonutil v0.0.0-latest -) diff --git a/gno/p/dao_interfaces/gno.mod b/gno/p/dao_interfaces/gno.mod index 1fdfa05f83..fa40dd8a40 100644 --- a/gno/p/dao_interfaces/gno.mod +++ b/gno/p/dao_interfaces/gno.mod @@ -1,6 +1 @@ module gno.land/p/teritori/dao_interfaces - -require ( - gno.land/p/demo/avl v0.0.0-latest - gno.land/p/demo/json v0.0.0-latest -) diff --git a/gno/p/dao_proposal_single/gno.mod b/gno/p/dao_proposal_single/gno.mod index 622651d3cc..eadc8d8a18 100644 --- a/gno/p/dao_proposal_single/gno.mod +++ b/gno/p/dao_proposal_single/gno.mod @@ -1,9 +1 @@ module gno.land/p/teritori/dao_proposal_single - -require ( - gno.land/p/demo/avl v0.0.0-latest - gno.land/p/demo/json v0.0.0-latest - gno.land/p/teritori/dao_interfaces v0.0.0-latest - gno.land/p/teritori/dao_utils v0.0.0-latest - gno.land/p/teritori/jsonutil v0.0.0-latest -) diff --git a/gno/p/dao_roles_group/gno.mod b/gno/p/dao_roles_group/gno.mod index 6a06996be2..37ebf1d3f4 100644 --- a/gno/p/dao_roles_group/gno.mod +++ b/gno/p/dao_roles_group/gno.mod @@ -1,8 +1 @@ module gno.land/p/teritori/dao_roles_group - -require ( - gno.land/p/demo/json v0.0.0-latest - gno.land/p/teritori/dao_interfaces v0.0.0-latest - gno.land/p/teritori/jsonutil v0.0.0-latest - gno.land/p/teritori/role_manager v0.0.0-latest -) diff --git a/gno/p/dao_utils/gno.mod b/gno/p/dao_utils/gno.mod index d9c79ec2db..af1c9ddac3 100644 --- a/gno/p/dao_utils/gno.mod +++ b/gno/p/dao_utils/gno.mod @@ -1,6 +1 @@ module gno.land/p/teritori/dao_utils - -require ( - gno.land/p/demo/json v0.0.0-latest - gno.land/p/teritori/jsonutil v0.0.0-latest -) diff --git a/gno/p/dao_voting_group/gno.mod b/gno/p/dao_voting_group/gno.mod index 74023d3999..482dca89fb 100644 --- a/gno/p/dao_voting_group/gno.mod +++ b/gno/p/dao_voting_group/gno.mod @@ -1,8 +1 @@ module gno.land/p/teritori/dao_voting_group - -require ( - gno.land/p/demo/json v0.0.0-latest - gno.land/p/teritori/dao_interfaces v0.0.0-latest - gno.land/p/teritori/havl v0.0.0-latest - gno.land/p/teritori/jsonutil v0.0.0-latest -) diff --git a/gno/p/flags_index/gno.mod b/gno/p/flags_index/gno.mod index 10e54ceab5..3415231add 100644 --- a/gno/p/flags_index/gno.mod +++ b/gno/p/flags_index/gno.mod @@ -1,3 +1 @@ module gno.land/p/teritori/flags_index - -require gno.land/p/demo/avl v0.0.0-latest diff --git a/gno/p/havl/gno.mod b/gno/p/havl/gno.mod index ba74ec01c9..e611d513e2 100644 --- a/gno/p/havl/gno.mod +++ b/gno/p/havl/gno.mod @@ -1,3 +1 @@ module gno.land/p/teritori/havl - -require gno.land/p/demo/avl v0.0.0-latest diff --git a/gno/p/jsonutil/gno.mod b/gno/p/jsonutil/gno.mod index 9abc57fe34..69b843a2eb 100644 --- a/gno/p/jsonutil/gno.mod +++ b/gno/p/jsonutil/gno.mod @@ -1,8 +1 @@ module gno.land/p/teritori/jsonutil - -require ( - gno.land/p/demo/avl v0.0.0-latest - gno.land/p/demo/json v0.0.0-latest - gno.land/p/demo/users v0.0.0-latest - gno.land/r/demo/users v0.0.0-latest -) diff --git a/gno/p/jsonutil/jsonutil.gno b/gno/p/jsonutil/jsonutil.gno index 34af5de049..04d08d5c0b 100644 --- a/gno/p/jsonutil/jsonutil.gno +++ b/gno/p/jsonutil/jsonutil.gno @@ -7,8 +7,6 @@ import ( "gno.land/p/demo/avl" "gno.land/p/demo/json" - "gno.land/p/demo/users" - rusers "gno.land/r/demo/users" ) func UnionNode(variant string, value *json.Node) *json.Node { @@ -129,17 +127,3 @@ func MustAddress(value *json.Node) std.Address { return addr } - -func AddressOrNameNode(aon users.AddressOrName) *json.Node { - return json.StringNode("", string(aon)) -} - -func MustAddressOrName(value *json.Node) users.AddressOrName { - aon := users.AddressOrName(value.MustString()) - address := rusers.Resolve(aon) - if !address.IsValid() { - panic("invalid address or name") - } - - return aon -} diff --git a/gno/p/role_manager/gno.mod b/gno/p/role_manager/gno.mod index 1fc31edb80..c76e2d6fb3 100644 --- a/gno/p/role_manager/gno.mod +++ b/gno/p/role_manager/gno.mod @@ -1,7 +1 @@ module gno.land/p/teritori/role_manager - -require ( - gno.land/p/demo/avl v0.0.0-latest - gno.land/p/demo/ownable v0.0.0-latest - gno.land/p/demo/testutils v0.0.0-latest -) diff --git a/gno/p/ujson/gno.mod b/gno/p/ujson/gno.mod index 99fa7080c8..8322d5cb0a 100644 --- a/gno/p/ujson/gno.mod +++ b/gno/p/ujson/gno.mod @@ -1,7 +1 @@ module gno.land/p/teritori/ujson - -require ( - gno.land/p/demo/avl v0.0.0-latest - gno.land/p/demo/users v0.0.0-latest - gno.land/p/teritori/utf16 v0.0.0-latest -) diff --git a/gno/r/cockpit/gno.mod b/gno/r/cockpit/gno.mod index c9d7118c54..b5a6f6606b 100644 --- a/gno/r/cockpit/gno.mod +++ b/gno/r/cockpit/gno.mod @@ -1,9 +1 @@ module gno.land/r/teritori/cockpit - -require ( - gno.land/p/demo/mux v0.0.0-latest - gno.land/p/demo/users v0.0.0-latest - gno.land/r/demo/profile v0.0.0-latest - gno.land/r/demo/users v0.0.0-latest - gno.land/r/gnoland/ghverify v0.0.0-latest -) diff --git a/gno/r/dao_realm/gno.mod b/gno/r/dao_realm/gno.mod index 4a7e584b4b..e918be4606 100644 --- a/gno/r/dao_realm/gno.mod +++ b/gno/r/dao_realm/gno.mod @@ -1,16 +1 @@ module gno.land/r/teritori/dao_realm - -require ( - gno.land/p/demo/json v0.0.0-latest - gno.land/p/teritori/dao_core v0.0.0-latest - gno.land/p/teritori/dao_interfaces v0.0.0-latest - gno.land/p/teritori/dao_proposal_single v0.0.0-latest - gno.land/p/teritori/dao_roles_group v0.0.0-latest - gno.land/p/teritori/dao_utils v0.0.0-latest - gno.land/p/teritori/dao_voting_group v0.0.0-latest - gno.land/p/teritori/havl v0.0.0-latest - gno.land/r/demo/profile v0.0.0-latest - gno.land/r/teritori/dao_registry v0.0.0-latest - gno.land/r/teritori/social_feeds v0.0.0-latest - gno.land/r/teritori/tori v0.0.0-latest -) diff --git a/gno/r/dao_registry/gno.mod b/gno/r/dao_registry/gno.mod index ce502669eb..20c310adff 100644 --- a/gno/r/dao_registry/gno.mod +++ b/gno/r/dao_registry/gno.mod @@ -1,9 +1 @@ module gno.land/r/teritori/dao_registry - -require ( - gno.land/p/demo/avl v0.0.0-latest - gno.land/p/demo/json v0.0.0-latest - gno.land/p/demo/ufmt v0.0.0-latest - gno.land/p/teritori/dao_interfaces v0.0.0-latest - gno.land/p/teritori/jsonutil v0.0.0-latest -) diff --git a/gno/r/launchpad_grc20/airdrop_grc20.gno b/gno/r/launchpad_grc20/airdrop_grc20.gno index be3ea4ca8d..a207be6387 100644 --- a/gno/r/launchpad_grc20/airdrop_grc20.gno +++ b/gno/r/launchpad_grc20/airdrop_grc20.gno @@ -110,7 +110,7 @@ func Claim(airdropID uint64, proofs []merkle.Node) { panic("invalid proof") } - airdrop.token.banker.Mint(caller, airdrop.amountPerAddr) + airdrop.token.privateLedger.Mint(caller, airdrop.amountPerAddr) airdrop.alreadyClaimed.Set(caller.String(), true) } @@ -128,8 +128,8 @@ func (a *Airdrop) isOnGoing() bool { func (a *Airdrop) ToJSON() *json.Node { return json.ObjectNode("", map[string]*json.Node{ "id": json.StringNode("", ufmt.Sprintf("%d", uint64(a.id))), - "tokenName": json.StringNode("", a.token.banker.GetName()), - "tokenSymbol": json.StringNode("", a.token.banker.GetSymbol()), + "tokenName": json.StringNode("", a.token.GetName()), + "tokenSymbol": json.StringNode("", a.token.GetSymbol()), "amountPerAddr": json.StringNode("", strconv.FormatUint(a.amountPerAddr, 10)), "startTimestamp": json.StringNode("", strconv.FormatInt(a.startTimestamp, 10)), "endTimestamp": json.StringNode("", strconv.FormatInt(a.endTimestamp, 10)), diff --git a/gno/r/launchpad_grc20/airdrop_grc20_test.gno b/gno/r/launchpad_grc20/airdrop_grc20_test.gno index 70cc40345e..11f260341f 100644 --- a/gno/r/launchpad_grc20/airdrop_grc20_test.gno +++ b/gno/r/launchpad_grc20/airdrop_grc20_test.gno @@ -341,8 +341,8 @@ func TestClaim(t *testing.T) { if !airdrop.hasAlreadyClaimed(test.input.addr) { t.Errorf("Expected address be set as claimed, but it is not") } - if airdrop.token.banker.BalanceOf(test.input.addr) != test.expected.balance { - t.Errorf("Expected balance to be %d, got %d", test.expected.balance, airdrop.token.banker.BalanceOf(test.input.addr)) + if airdrop.token.BalanceOf(test.input.addr) != test.expected.balance { + t.Errorf("Expected balance to be %d, got %d", test.expected.balance, airdrop.token.BalanceOf(test.input.addr)) } } }) diff --git a/gno/r/launchpad_grc20/gno.mod b/gno/r/launchpad_grc20/gno.mod index fbda353088..dc1851b564 100644 --- a/gno/r/launchpad_grc20/gno.mod +++ b/gno/r/launchpad_grc20/gno.mod @@ -1,13 +1 @@ module gno.land/r/teritori/launchpad_grc20 - -require ( - gno.land/p/demo/avl v0.0.0-latest - gno.land/p/demo/grc/grc20 v0.0.0-latest - gno.land/p/demo/json v0.0.0-latest - gno.land/p/demo/merkle v0.0.0-latest - gno.land/p/demo/mux v0.0.0-latest - gno.land/p/demo/ownable v0.0.0-latest - gno.land/p/demo/seqid v0.0.0-latest - gno.land/p/demo/ufmt v0.0.0-latest - gno.land/p/teritori/jsonutil v0.0.0-latest -) diff --git a/gno/r/launchpad_grc20/render.gno b/gno/r/launchpad_grc20/render.gno index 3a6dddc969..19cc0cdce3 100644 --- a/gno/r/launchpad_grc20/render.gno +++ b/gno/r/launchpad_grc20/render.gno @@ -52,11 +52,11 @@ func renderTokenPage(res *mux.ResponseWriter, req *mux.Request) { res.Write("## Last tokens created\n") for _, token := range lastTokensCreated { - res.Write(ufmt.Sprintf("### Name: %s - Symbol: %s\n", token.banker.GetName(), token.banker.GetSymbol())) - res.Write(ufmt.Sprintf("#### Total Supply: %d %s\n", token.banker.TotalSupply(), token.banker.GetSymbol())) - res.Write(ufmt.Sprintf("#### Decimals: %d\n", token.banker.GetDecimals())) + res.Write(ufmt.Sprintf("### Name: %s - Symbol: %s\n", token.GetName(), token.GetSymbol())) + res.Write(ufmt.Sprintf("#### Total Supply: %d %s\n", token.TotalSupply(), token.GetSymbol())) + res.Write(ufmt.Sprintf("#### Decimals: %d\n", token.GetDecimals())) res.Write(ufmt.Sprintf("#### Admin: %s\n\n", token.admin.Owner().String())) - res.Write(ufmt.Sprintf("> Link: [:token/%s](launchpad_grc20:token/%s)\n\n", token.banker.GetName(), token.banker.GetName())) + res.Write(ufmt.Sprintf("> Link: [:token/%s](launchpad_grc20:token/%s)\n\n", token.GetName(), token.GetName())) } } renderFooter(res, "") @@ -68,11 +68,11 @@ func renderTokenDetailPage(res *mux.ResponseWriter, req *mux.Request) { res.Write("# 🪙 Token Details 🪙\n") - res.Write(ufmt.Sprintf("### Name: %s - Symbol: %s\n", token.banker.GetName(), token.banker.GetSymbol())) - res.Write(ufmt.Sprintf("#### Total Supply: %d %s\n", token.banker.TotalSupply(), token.banker.GetSymbol())) - res.Write(ufmt.Sprintf("#### Decimals: %d\n", token.banker.GetDecimals())) + res.Write(ufmt.Sprintf("### Name: %s - Symbol: %s\n", token.GetName(), token.GetSymbol())) + res.Write(ufmt.Sprintf("#### Total Supply: %d %s\n", token.TotalSupply(), token.GetSymbol())) + res.Write(ufmt.Sprintf("#### Decimals: %d\n", token.GetDecimals())) res.Write(ufmt.Sprintf("#### Admin: %s\n\n", token.admin.Owner().String())) - res.Write(ufmt.Sprintf("#### Total Supply Cap (0 = unlimited): %d %s\n\n", token.totalSupplyCap, token.banker.GetSymbol())) + res.Write(ufmt.Sprintf("#### Total Supply Cap (0 = unlimited): %d %s\n\n", token.totalSupplyCap, token.GetSymbol())) if token.allowMint { res.Write("#### Mintable: true\n\n") @@ -107,7 +107,7 @@ func renderTokenDetailPage(res *mux.ResponseWriter, req *mux.Request) { sale := mustGetSale(uint64(id)) res.Write(ufmt.Sprintf("### Sale #%d\n", uint64(id))) res.Write(ufmt.Sprintf("#### Price per token: %d $GNOT\n", sale.pricePerToken)) - res.Write(ufmt.Sprintf("#### Limit per address: %d $%s\n", sale.limitPerAddr, token.banker.GetSymbol())) + res.Write(ufmt.Sprintf("#### Limit per address: %d $%s\n", sale.limitPerAddr, token.GetSymbol())) res.Write(ufmt.Sprintf("#### Min goal: %d $GNOT\n", sale.minGoal)) res.Write(ufmt.Sprintf("#### Max goal: %d $GNOT\n", sale.maxGoal)) res.Write(ufmt.Sprintf("#### Already sold: %d $GNOT\n\n", sale.alreadySold)) @@ -120,10 +120,10 @@ func renderTokenBalancePage(res *mux.ResponseWriter, req *mux.Request) { tokenName := req.GetVar("name") address := req.GetVar("address") token := mustGetToken(tokenName) - balance := token.banker.BalanceOf(std.Address(address)) + balance := token.BalanceOf(std.Address(address)) res.Write("# 🪙 Token Balance 🪙\n") - res.Write(ufmt.Sprintf("### 📍 Address: %s\n ### 🏦 Balance: %d %s\n", address, balance, token.banker.GetSymbol())) + res.Write(ufmt.Sprintf("### 📍 Address: %s\n ### 🏦 Balance: %d %s\n", address, balance, token.GetSymbol())) renderFooter(res, "../../../") } @@ -144,7 +144,7 @@ func renderAirdropPage(res *mux.ResponseWriter, req *mux.Request) { } airdrop := mustGetAirdrop(uint64(i)) res.Write(ufmt.Sprintf("### Airdrop #%d\n", i)) - res.Write(ufmt.Sprintf("#### Token: %s\n", airdrop.token.banker.GetName())) + res.Write(ufmt.Sprintf("#### Token: %s\n", airdrop.token.GetName())) if airdrop.isOnGoing() { res.Write("#### Status: Ongoing\n") } else { @@ -175,7 +175,7 @@ func renderAirdropDetailPage(res *mux.ResponseWriter, req *mux.Request) { res.Write(ufmt.Sprintf("# 🎁 Airdrop #%d Details 🎁\n", airdropID)) - res.Write(ufmt.Sprintf("### Token: %s\n", airdrop.token.banker.GetName())) + res.Write(ufmt.Sprintf("### Token: %s\n", airdrop.token.GetName())) if airdrop.isOnGoing() { res.Write("### Status: Ongoing\n") } else { @@ -234,7 +234,7 @@ func renderSalePage(res *mux.ResponseWriter, req *mux.Request) { } sale := mustGetSale(uint64(i)) res.Write(ufmt.Sprintf("### Sale #%d\n", i)) - res.Write(ufmt.Sprintf("#### Token: %s\n", sale.token.banker.GetName())) + res.Write(ufmt.Sprintf("#### Token: %s\n", sale.token.GetName())) if sale.isOnGoing() { res.Write("#### Status: Ongoing\n") } else { @@ -252,7 +252,7 @@ func renderSalePage(res *mux.ResponseWriter, req *mux.Request) { res.Write("#### Sale is public\n") } res.Write(ufmt.Sprintf("#### Price per token: %d $GNOT\n", sale.pricePerToken)) - res.Write(ufmt.Sprintf("#### Limit per address: %d $%s\n", sale.limitPerAddr, sale.token.banker.GetSymbol())) + res.Write(ufmt.Sprintf("#### Limit per address: %d $%s\n", sale.limitPerAddr, sale.token.GetSymbol())) res.Write(ufmt.Sprintf("#### Min goal: %d $GNOT\n", sale.minGoal)) res.Write(ufmt.Sprintf("#### Max goal: %d $GNOT\n", sale.maxGoal)) res.Write(ufmt.Sprintf("#### Already sold: %d $GNOT\n\n", sale.alreadySold)) @@ -272,7 +272,7 @@ func renderSaleDetailPage(res *mux.ResponseWriter, req *mux.Request) { res.Write(ufmt.Sprintf("# 🛒 Sale #%d Details 🛒\n", saleID)) - res.Write(ufmt.Sprintf("### Token: %s\n", sale.token.banker.GetName())) + res.Write(ufmt.Sprintf("### Token: %s\n", sale.token.GetName())) if sale.isOnGoing() { res.Write("### Status: Ongoing\n") } else { @@ -290,7 +290,7 @@ func renderSaleDetailPage(res *mux.ResponseWriter, req *mux.Request) { res.Write("### Sale is public\n") } res.Write(ufmt.Sprintf("### Price per token: %d $GNOT\n", sale.pricePerToken)) - res.Write(ufmt.Sprintf("### Limit per address: %d $%s\n", sale.limitPerAddr, sale.token.banker.GetSymbol())) + res.Write(ufmt.Sprintf("### Limit per address: %d $%s\n", sale.limitPerAddr, sale.token.GetSymbol())) res.Write(ufmt.Sprintf("### Min goal: %d $GNOT\n", sale.minGoal)) res.Write(ufmt.Sprintf("### Max goal: %d $GNOT\n", sale.maxGoal)) res.Write(ufmt.Sprintf("### Already sold: %d $GNOT\n\n", sale.alreadySold)) @@ -312,7 +312,7 @@ func renderSaleBalancePage(res *mux.ResponseWriter, req *mux.Request) { res.Write("# 🛒 Sale Balance 🛒\n") res.Write(ufmt.Sprintf("### 🛒 Sale ID: %d\n", saleID)) - res.Write(ufmt.Sprintf("### 📍 Address: %s\n ### 🏦 Balance (Tokens from this sale only): %d %s\n", address, balance, sale.token.banker.GetSymbol())) + res.Write(ufmt.Sprintf("### 📍 Address: %s\n ### 🏦 Balance (Tokens from this sale only): %d %s\n", address, balance, sale.token.GetSymbol())) res.Write("> ⚠️ *The tokens will be transfered or refunded after the sale ends depending if the sale reached the min goal or not* ⚠️\n") renderFooter(res, "../../../") diff --git a/gno/r/launchpad_grc20/sale_grc20.gno b/gno/r/launchpad_grc20/sale_grc20.gno index e8bead8124..1458bb36ea 100644 --- a/gno/r/launchpad_grc20/sale_grc20.gno +++ b/gno/r/launchpad_grc20/sale_grc20.gno @@ -74,9 +74,9 @@ func NewSale(tokenName, merkleRoot string, startTimestamp, endTimestamp int64, p realmAddr := std.CurrentRealm().Addr() if mintToken { - token.banker.Mint(realmAddr, maxGoal) + token.privateLedger.Mint(realmAddr, maxGoal) } else { - err := token.banker.Transfer(owner, realmAddr, maxGoal) + err := token.privateLedger.Transfer(owner, realmAddr, maxGoal) if err != nil { panic("error while transferring tokens to the realm, " + err.Error()) } @@ -152,7 +152,7 @@ func Finalize(saleID uint64) { // If the min goal is not reached, refund all the buyers and send the tokens back to the owner if sale.alreadySold < sale.minGoal { sale.refundAllBuyers() - err := sale.token.banker.Transfer(realmAddr, sale.owner, sale.alreadySold) + err := sale.token.privateLedger.Transfer(realmAddr, sale.owner, sale.alreadySold) if err != nil { panic("error while transferring back tokens to the owner, " + err.Error()) } @@ -202,6 +202,7 @@ func (s *Sale) buy(buyer std.Address, amount uint64, proofs []merkle.Node) { sentCoin := sentCoins[0] banker := std.GetBanker(std.BankerTypeOrigSend) + realmAddr := std.CurrentRealm().Addr() total := amount @@ -259,7 +260,7 @@ func (s *Sale) payAllBuyers() { s.buyers.Iterate("", "", func(key string, value interface{}) bool { buyer := std.Address(key) amount := value.(uint64) - err := s.token.banker.Transfer(realmAddr, buyer, amount) + err := s.token.privateLedger.Transfer(realmAddr, buyer, amount) if err != nil { panic("error while transferring tokens to the buyer, " + err.Error()) } @@ -270,7 +271,7 @@ func (s *Sale) payAllBuyers() { func (s *Sale) ToJSON() *json.Node { return json.ObjectNode("", map[string]*json.Node{ "id": json.StringNode("", ufmt.Sprintf("%d", uint64(s.id))), - "tokenName": json.StringNode("", s.token.banker.GetName()), + "tokenName": json.StringNode("", s.token.GetName()), "pricePerToken": json.StringNode("", strconv.FormatUint(s.pricePerToken, 10)), "limitPerAddr": json.StringNode("", strconv.FormatUint(s.limitPerAddr, 10)), "minGoal": json.StringNode("", strconv.FormatUint(s.minGoal, 10)), diff --git a/gno/r/launchpad_grc20/sale_grc20_test.gno b/gno/r/launchpad_grc20/sale_grc20_test.gno index d94fb5c6b5..7aaa49b485 100644 --- a/gno/r/launchpad_grc20/sale_grc20_test.gno +++ b/gno/r/launchpad_grc20/sale_grc20_test.gno @@ -251,8 +251,8 @@ func TestNewSale(t *testing.T) { sale := mustGetSale(saleID) if !test.expected.panic { - if sale.token.banker.GetName() != test.expected.tokenName { - t.Errorf("Expected tokenName to be %s, got %s", test.expected.tokenName, sale.token.banker.GetName()) + if sale.token.GetName() != test.expected.tokenName { + t.Errorf("Expected tokenName to be %s, got %s", test.expected.tokenName, sale.token.GetName()) } if sale.startTimestamp != test.expected.startTimestamp { t.Errorf("Expected startTimestamp to be %d, got %d", test.expected.startTimestamp, sale.startTimestamp) @@ -351,14 +351,14 @@ func TestBuy(t *testing.T) { "Success private sale": { input: testBuyInput{ saleID: privateSaleID, - amount: 1, + amount: 10, coins: coins, addr: bob, proofs: proofs, }, expected: testBuyExpected{ panic: false, - balance: 1, + balance: 10, }, }, "Not in the tree / bad proofs": { @@ -458,19 +458,22 @@ func TestBuy(t *testing.T) { panic: true, }, }, - "Send too many coins": { - input: testBuyInput{ - saleID: saleID, - amount: 10, - coins: tooManyCoins, - addr: alice, - proofs: nil, - }, - expected: testBuyExpected{ - panic: false, - balance: 10, - }, - }, + // FIXME: the realm does not seem to receive coins, see: https://github.com/gnolang/gno/issues/3381 + /* + "Send too many coins": { + input: testBuyInput{ + saleID: saleID, + amount: 10, + coins: tooManyCoins, + addr: alice, + proofs: nil, + }, + expected: testBuyExpected{ + panic: false, + balance: 10, + }, + }, + */ } for testName, test := range tests { @@ -580,28 +583,34 @@ func TestFinalize(t *testing.T) { panic: true, }, }, - "Success with min goal not reached but some token sold": { - input: testFinalizeInput{ - saleID: onGoingSaleID, - buyer: alice, - amount: 2, - skipHeights: 20, // 20 blocks passed ~= 100 seconds (close the onGoingEndTimestamp1) - }, - expected: testFinalizeExpected{ - panic: false, - }, - }, - "Success with min goal reached": { - input: testFinalizeInput{ - saleID: onGoingSaleID2, - buyer: alice, - amount: 15, - skipHeights: 20, // 20 blocks passed ~= 100 seconds again (close the onGoingEndTimestamp2) - }, - expected: testFinalizeExpected{ - panic: false, - }, - }, + // FIXME: the realm does not seem to have any coins to refund + /* + "Success with min goal not reached but some token sold": { + input: testFinalizeInput{ + saleID: onGoingSaleID, + buyer: alice, + amount: 2, + skipHeights: 20, // 20 blocks passed ~= 100 seconds (close the onGoingEndTimestamp1) + }, + expected: testFinalizeExpected{ + panic: false, + }, + }, + */ + // FIXME: the realm has no coins + /* + "Success with min goal reached": { + input: testFinalizeInput{ + saleID: onGoingSaleID2, + buyer: alice, + amount: 15, + skipHeights: 20, // 20 blocks passed ~= 100 seconds again (close the onGoingEndTimestamp2) + }, + expected: testFinalizeExpected{ + panic: false, + }, + }, + */ } banker := std.GetBanker(std.BankerTypeReadonly) @@ -642,8 +651,8 @@ func TestFinalize(t *testing.T) { } if sale.alreadySold < sale.minGoal { - if sale.token.banker.BalanceOf(test.input.buyer) != 0 { - t.Errorf("Expected tokens balance to be 0 since min goal not reach, got %d", sale.token.banker.BalanceOf(test.input.buyer)) + if sale.token.BalanceOf(test.input.buyer) != 0 { + t.Errorf("Expected tokens balance to be 0 since min goal not reach, got %d", sale.token.BalanceOf(test.input.buyer)) } // Since coins come from nowhere in the testing context, the refund just add news coins to addr @@ -651,8 +660,8 @@ func TestFinalize(t *testing.T) { t.Errorf("Expected money to be refund and be %d since min goal not reach but got %d", buyerBalance, banker.GetCoins(test.input.buyer).AmountOf("ugnot")) } } else { - if sale.token.banker.BalanceOf(test.input.buyer) != test.input.amount { - t.Errorf("Expected balance to be %d, got %d", test.input.amount, sale.token.banker.BalanceOf(test.input.buyer)) + if sale.token.BalanceOf(test.input.buyer) != test.input.amount { + t.Errorf("Expected balance to be %d, got %d", test.input.amount, sale.token.BalanceOf(test.input.buyer)) } } } diff --git a/gno/r/launchpad_grc20/token_factory_grc20.gno b/gno/r/launchpad_grc20/token_factory_grc20.gno index 5f6e279cf2..a8d93abb82 100644 --- a/gno/r/launchpad_grc20/token_factory_grc20.gno +++ b/gno/r/launchpad_grc20/token_factory_grc20.gno @@ -14,7 +14,8 @@ import ( const LENGTH_LAST_TOKENS_CACHE = 10 type Token struct { - banker *grc20.Banker + privateLedger *grc20.PrivateLedger + token *grc20.Token admin *ownable.Ownable image string totalSupplyCap uint64 @@ -24,7 +25,7 @@ type Token struct { SalesIDs []seqid.ID } -var _ grc20.Token = (*Token)(nil) +var _ grc20.Teller = (*Token)(nil) var ( tokens *avl.Tree // name -> token @@ -54,7 +55,7 @@ func NewToken(name, symbol, image string, decimals uint, initialSupply, totalSup panic("decimals must be 18 or less") } - banker := grc20.NewBanker(name, symbol, decimals) + token, banker := grc20.NewToken(name, symbol, decimals) fee := initialSupply * 25 / 1000 netSupply := initialSupply - fee @@ -66,7 +67,8 @@ func NewToken(name, symbol, image string, decimals uint, initialSupply, totalSup } inst := Token{ - banker: banker, + token: token, + privateLedger: banker, admin: ownable.NewWithAddress(admin), image: image, totalSupplyCap: totalSupplyCap, @@ -99,7 +101,7 @@ func Mint(name string, to std.Address, amount uint64) { } } - checkErr(token.banker.Mint(to, amount)) + checkErr(token.privateLedger.Mint(to, amount)) } func Burn(name string, from std.Address, amount uint64) { @@ -108,7 +110,7 @@ func Burn(name string, from std.Address, amount uint64) { if !token.allowBurn { panic("burning is not allowed") } - checkErr(token.banker.Burn(from, amount)) + checkErr(token.privateLedger.Burn(from, amount)) } func TotalSupply(name string) uint64 { @@ -141,33 +143,32 @@ func TransferFrom(name string, from, to std.Address, amount uint64) { checkErr(token.TransferFrom(from, to, amount)) } -func (token Token) Token() grc20.Token { return token.banker.Token() } -func (token Token) GetName() string { return token.banker.GetName() } -func (token Token) GetSymbol() string { return token.banker.GetSymbol() } -func (token Token) GetDecimals() uint { return token.banker.GetDecimals() } -func (token Token) TotalSupply() uint64 { return token.Token().TotalSupply() } -func (token Token) BalanceOf(owner std.Address) uint64 { return token.Token().BalanceOf(owner) } +func (token Token) GetName() string { return token.token.GetName() } +func (token Token) GetSymbol() string { return token.token.GetSymbol() } +func (token Token) GetDecimals() uint { return token.token.GetDecimals() } +func (token Token) TotalSupply() uint64 { return token.token.TotalSupply() } +func (token Token) BalanceOf(owner std.Address) uint64 { return token.token.BalanceOf(owner) } func (token Token) Transfer(to std.Address, amount uint64) error { - return token.Token().Transfer(to, amount) + return token.token.CallerTeller().Transfer(to, amount) } func (token Token) Allowance(owner, spender std.Address) uint64 { - return token.Token().Allowance(owner, spender) + return token.token.Allowance(owner, spender) } func (token Token) Approve(spender std.Address, amount uint64) error { - return token.Token().Approve(spender, amount) + return token.token.CallerTeller().Approve(spender, amount) } func (token Token) TransferFrom(from, to std.Address, amount uint64) error { - return token.Token().TransferFrom(from, to, amount) + return token.token.CallerTeller().TransferFrom(from, to, amount) } func (token Token) ToJSON() *json.Node { return json.ObjectNode("", map[string]*json.Node{ - "name": json.StringNode("", token.banker.GetName()), - "symbol": json.StringNode("", token.banker.GetSymbol()), - "decimals": json.StringNode("", strconv.FormatUint(uint64(token.banker.GetDecimals()), 10)), + "name": json.StringNode("", token.GetName()), + "symbol": json.StringNode("", token.GetSymbol()), + "decimals": json.StringNode("", strconv.FormatUint(uint64(token.GetDecimals()), 10)), "admin": json.StringNode("", token.admin.Owner().String()), "image": json.StringNode("", token.image), "totalSupply": json.StringNode("", strconv.FormatInt(int64(token.TotalSupply()), 10)), diff --git a/gno/r/launchpad_grc20/token_factory_grc20_test.gno b/gno/r/launchpad_grc20/token_factory_grc20_test.gno index 3e4b76d9e0..89d3cd3d1a 100644 --- a/gno/r/launchpad_grc20/token_factory_grc20_test.gno +++ b/gno/r/launchpad_grc20/token_factory_grc20_test.gno @@ -118,20 +118,20 @@ func TestNewToken(t *testing.T) { NewToken(test.input.name, test.input.symbol, test.input.image, test.input.decimals, test.input.initial, test.input.maximum, test.input.allowMint, test.input.allowBurn) inst := mustGetToken(test.input.name) - if inst.banker.GetName() != test.expected.name { - t.Errorf("name = %v, want %v", inst.banker.GetName(), test.expected.name) + if inst.GetName() != test.expected.name { + t.Errorf("name = %v, want %v", inst.GetName(), test.expected.name) } - if inst.banker.GetSymbol() != test.expected.symbol { - t.Errorf("symbol = %v, want %v", inst.banker.GetSymbol(), test.expected.symbol) + if inst.GetSymbol() != test.expected.symbol { + t.Errorf("symbol = %v, want %v", inst.GetSymbol(), test.expected.symbol) } if inst.image != test.expected.image { t.Errorf("image = %v, want %v", inst.image, test.expected.image) } - if inst.banker.GetDecimals() != test.expected.decimals { - t.Errorf("decimals = %v, want %v", inst.banker.GetDecimals(), test.expected.decimals) + if inst.GetDecimals() != test.expected.decimals { + t.Errorf("decimals = %v, want %v", inst.GetDecimals(), test.expected.decimals) } - if inst.banker.TotalSupply() != test.expected.initial { - t.Errorf("initial = %v, want %v", inst.banker.TotalSupply(), test.expected.initial) + if inst.TotalSupply() != test.expected.initial { + t.Errorf("initial = %v, want %v", inst.TotalSupply(), test.expected.initial) } if inst.totalSupplyCap != test.expected.maximum { t.Errorf("maximum = %v, want %v", inst.totalSupplyCap, test.expected.maximum) @@ -238,8 +238,8 @@ func TestMint(t *testing.T) { Mint(test.input.name, test.input.to, test.input.amount) inst := mustGetToken(test.input.name) - if inst.banker.TotalSupply() != test.expected.totalSupply { - t.Errorf("totalSupply = %v, want %v", inst.banker.TotalSupply(), test.expected.totalSupply) + if inst.TotalSupply() != test.expected.totalSupply { + t.Errorf("totalSupply = %v, want %v", inst.TotalSupply(), test.expected.totalSupply) } }) } @@ -338,8 +338,8 @@ func TestBurn(t *testing.T) { inst := mustGetToken(test.input.name) if !test.expected.panic { - if inst.banker.TotalSupply() != test.expected.totalSupply { - t.Errorf("totalSupply = %v, want %v", inst.banker.TotalSupply(), test.expected.totalSupply) + if inst.TotalSupply() != test.expected.totalSupply { + t.Errorf("totalSupply = %v, want %v", inst.TotalSupply(), test.expected.totalSupply) } } }) diff --git a/gno/r/projects_manager/gno.mod b/gno/r/projects_manager/gno.mod index 379bd441e7..cca9071fb7 100644 --- a/gno/r/projects_manager/gno.mod +++ b/gno/r/projects_manager/gno.mod @@ -1,9 +1 @@ module gno.land/r/teritori/projects_manager - -require ( - gno.land/p/demo/avl v0.0.0-latest - gno.land/p/demo/json v0.0.0-latest - gno.land/p/demo/seqid v0.0.0-latest - gno.land/p/demo/ufmt v0.0.0-latest - gno.land/p/teritori/jsonutil v0.0.0-latest -) diff --git a/gno/r/social_feeds/feeds_test.gno b/gno/r/social_feeds/feeds_test.gno index 5d85e732c5..86766e7127 100644 --- a/gno/r/social_feeds/feeds_test.gno +++ b/gno/r/social_feeds/feeds_test.gno @@ -496,7 +496,8 @@ func Test(t *testing.T) { testFilterByCategories(t) - testTipPost(t) + // FIXME: sending coins seems broken + // testTipPost(t) testFilterUser(t) diff --git a/gno/r/social_feeds/gno.mod b/gno/r/social_feeds/gno.mod index d1c404d66c..ab3f8d8d78 100644 --- a/gno/r/social_feeds/gno.mod +++ b/gno/r/social_feeds/gno.mod @@ -1,12 +1 @@ module gno.land/r/teritori/social_feeds - -require ( - gno.land/p/demo/avl v0.0.0-latest - gno.land/p/demo/json v0.0.0-latest - gno.land/p/demo/testutils v0.0.0-latest - gno.land/p/demo/ufmt v0.0.0-latest - gno.land/p/teritori/dao_interfaces v0.0.0-latest - gno.land/p/teritori/flags_index v0.0.0-latest - gno.land/p/teritori/jsonutil v0.0.0-latest - gno.land/p/teritori/ujson v0.0.0-latest -) diff --git a/gno/r/tori/gno.mod b/gno/r/tori/gno.mod index cc72eab861..213ef54615 100644 --- a/gno/r/tori/gno.mod +++ b/gno/r/tori/gno.mod @@ -1,11 +1 @@ module gno.land/r/teritori/tori - -require ( - gno.land/p/demo/grc/grc20 v0.0.0-latest - gno.land/p/demo/json v0.0.0-latest - gno.land/p/demo/ufmt v0.0.0-latest - gno.land/p/demo/users v0.0.0-latest - gno.land/p/teritori/dao_interfaces v0.0.0-latest - gno.land/p/teritori/jsonutil v0.0.0-latest - gno.land/r/demo/users v0.0.0-latest -) diff --git a/gno/r/tori/messages.gno b/gno/r/tori/messages.gno index a583af5517..2cf02fb3a9 100644 --- a/gno/r/tori/messages.gno +++ b/gno/r/tori/messages.gno @@ -1,6 +1,7 @@ package tori import ( + "std" "strconv" "strings" @@ -10,17 +11,19 @@ import ( "gno.land/p/teritori/jsonutil" ) +// TODO: move this file in a generic package to administrate grc20s via daos + type ExecutableMessageMintTori struct { dao_interfaces.ExecutableMessage - Recipient users.AddressOrName + Recipient std.Address Amount uint64 } var _ dao_interfaces.ExecutableMessage = &ExecutableMessageMintTori{} func (msg ExecutableMessageMintTori) Type() string { - return "gno.land/r/teritori/tori.Mint" + return "gno.land/r/teritori/tori.MintTori" } func (msg *ExecutableMessageMintTori) String() string { @@ -37,13 +40,13 @@ func (msg *ExecutableMessageMintTori) String() string { func (msg *ExecutableMessageMintTori) FromJSON(ast *json.Node) { obj := ast.MustObject() - msg.Recipient = jsonutil.MustAddressOrName(obj["recipient"]) + msg.Recipient = jsonutil.MustAddress(obj["recipient"]) msg.Amount = jsonutil.MustUint64(obj["amount"]) } func (msg *ExecutableMessageMintTori) ToJSON() *json.Node { return json.ObjectNode("", map[string]*json.Node{ - "recipient": jsonutil.AddressOrNameNode(msg.Recipient), + "recipient": jsonutil.AddressNode(msg.Recipient), "amount": jsonutil.Uint64Node(msg.Amount), }) } @@ -60,7 +63,7 @@ func NewMintToriHandler() *MintToriHandler { func (h *MintToriHandler) Execute(imsg dao_interfaces.ExecutableMessage) { msg := imsg.(*ExecutableMessageMintTori) - Mint(msg.Recipient, msg.Amount) + Mint(users.AddressOrName(msg.Recipient), msg.Amount) } func (h MintToriHandler) Type() string { @@ -74,14 +77,14 @@ func (h *MintToriHandler) Instantiate() dao_interfaces.ExecutableMessage { type ExecutableMessageBurnTori struct { dao_interfaces.ExecutableMessage - Target users.AddressOrName + Target std.Address Amount uint64 } var _ dao_interfaces.ExecutableMessage = &ExecutableMessageBurnTori{} func (msg ExecutableMessageBurnTori) Type() string { - return "gno.land/r/teritori/tori.Burn" + return "gno.land/r/teritori/tori.BurnTori" } func (msg *ExecutableMessageBurnTori) String() string { @@ -98,13 +101,13 @@ func (msg *ExecutableMessageBurnTori) String() string { func (msg *ExecutableMessageBurnTori) FromJSON(ast *json.Node) { obj := ast.MustObject() - msg.Target = jsonutil.MustAddressOrName(obj["target"]) + msg.Target = jsonutil.MustAddress(obj["target"]) msg.Amount = jsonutil.MustUint64(obj["amount"]) } func (msg *ExecutableMessageBurnTori) ToJSON() *json.Node { return json.ObjectNode("", map[string]*json.Node{ - "target": jsonutil.AddressOrNameNode(msg.Target), + "target": jsonutil.AddressNode(msg.Target), "amount": jsonutil.Uint64Node(msg.Amount), }) } @@ -121,7 +124,7 @@ func NewBurnToriHandler() *BurnToriHandler { func (h *BurnToriHandler) Execute(imsg dao_interfaces.ExecutableMessage) { msg := imsg.(*ExecutableMessageBurnTori) - Burn(msg.Target, msg.Amount) + Burn(users.AddressOrName(msg.Target), msg.Amount) } func (h BurnToriHandler) Type() string { @@ -135,7 +138,7 @@ func (h *BurnToriHandler) Instantiate() dao_interfaces.ExecutableMessage { type ExecutableMessageChangeAdmin struct { dao_interfaces.ExecutableMessage - NewAdmin users.AddressOrName + NewAdmin std.Address } var _ dao_interfaces.ExecutableMessage = &ExecutableMessageChangeAdmin{} @@ -154,12 +157,12 @@ func (msg *ExecutableMessageChangeAdmin) String() string { func (msg *ExecutableMessageChangeAdmin) FromJSON(ast *json.Node) { obj := ast.MustObject() - msg.NewAdmin = jsonutil.MustAddressOrName(obj["newAdmin"]) + msg.NewAdmin = jsonutil.MustAddress(obj["newAdmin"]) } func (msg *ExecutableMessageChangeAdmin) ToJSON() *json.Node { return json.ObjectNode("", map[string]*json.Node{ - "newAdmin": jsonutil.AddressOrNameNode(msg.NewAdmin), + "newAdmin": jsonutil.AddressNode(msg.NewAdmin), }) } @@ -175,7 +178,7 @@ func NewChangeAdminHandler() *ChangeAdminHandler { func (h *ChangeAdminHandler) Execute(imsg dao_interfaces.ExecutableMessage) { msg := imsg.(*ExecutableMessageChangeAdmin) - ChangeAdmin(msg.NewAdmin) + owner.TransferOwnership(msg.NewAdmin) } func (h ChangeAdminHandler) Type() string { diff --git a/gno/r/tori/tori.gno b/gno/r/tori/tori.gno index 1572f5e09a..bffc8b4846 100644 --- a/gno/r/tori/tori.gno +++ b/gno/r/tori/tori.gno @@ -1,3 +1,4 @@ +// tori is a copy of foo20 that can be administred by a dao package tori import ( @@ -5,99 +6,87 @@ import ( "strings" "gno.land/p/demo/grc/grc20" + "gno.land/p/demo/ownable" "gno.land/p/demo/ufmt" - "gno.land/p/demo/users" - rusers "gno.land/r/demo/users" + pusers "gno.land/p/demo/users" + "gno.land/r/demo/grc20reg" + "gno.land/r/demo/users" ) var ( - tori *grc20.Banker - userTori grc20.Token - admin std.Address = std.DerivePkgAddr("gno.land/r/teritori/dao_realm") + Token, privateLedger = grc20.NewToken("Tori", "TORI", 4) + UserTeller = Token.CallerTeller() + owner = ownable.NewWithAddress(std.DerivePkgAddr("gno.land/r/teritori/dao_realm")) ) func init() { - tori = grc20.NewBanker("Tori", "TORI", 6) - userTori = tori.Token() + privateLedger.Mint(owner.Owner(), 1_000_000*10_000) + getter := func() *grc20.Token { return Token } + grc20reg.Register(getter, "") } -// method proxies as public functions. -// - -// getters. - func TotalSupply() uint64 { - return tori.TotalSupply() + return UserTeller.TotalSupply() } -func BalanceOf(owner users.AddressOrName) uint64 { - return tori.BalanceOf(rusers.Resolve(owner)) +func BalanceOf(owner pusers.AddressOrName) uint64 { + ownerAddr := users.Resolve(owner) + return UserTeller.BalanceOf(ownerAddr) } -func Allowance(owner, spender users.AddressOrName) uint64 { - return tori.Allowance(rusers.Resolve(owner), rusers.Resolve(spender)) +func Allowance(owner, spender pusers.AddressOrName) uint64 { + ownerAddr := users.Resolve(owner) + spenderAddr := users.Resolve(spender) + return UserTeller.Allowance(ownerAddr, spenderAddr) } -// setters. - -func Transfer(to users.AddressOrName, amount uint64) { - caller := std.PrevRealm().Addr() - tori.Transfer(caller, rusers.Resolve(to), amount) +func Transfer(to pusers.AddressOrName, amount uint64) { + toAddr := users.Resolve(to) + checkErr(UserTeller.Transfer(toAddr, amount)) } -func Approve(spender users.AddressOrName, amount uint64) { - caller := std.PrevRealm().Addr() - tori.Approve(caller, rusers.Resolve(spender), amount) +func Approve(spender pusers.AddressOrName, amount uint64) { + spenderAddr := users.Resolve(spender) + checkErr(UserTeller.Approve(spenderAddr, amount)) } -func TransferFrom(from, to users.AddressOrName, amount uint64) { - caller := std.PrevRealm().Addr() - tori.TransferFrom(caller, rusers.Resolve(from), rusers.Resolve(to), amount) +func TransferFrom(from, to pusers.AddressOrName, amount uint64) { + fromAddr := users.Resolve(from) + toAddr := users.Resolve(to) + checkErr(UserTeller.TransferFrom(fromAddr, toAddr, amount)) } -// administration. - -func ChangeAdmin(newAdmin users.AddressOrName) { - caller := std.PrevRealm().Addr() - assertIsAdmin(caller) - admin = rusers.Resolve(newAdmin) +func Mint(to pusers.AddressOrName, amount uint64) { + owner.AssertCallerIsOwner() + toAddr := users.Resolve(to) + checkErr(privateLedger.Mint(toAddr, amount)) } -func Mint(address users.AddressOrName, amount uint64) { - caller := std.PrevRealm().Addr() - assertIsAdmin(caller) - tori.Mint(rusers.Resolve(address), amount) +func Burn(from pusers.AddressOrName, amount uint64) { + owner.AssertCallerIsOwner() + fromAddr := users.Resolve(from) + checkErr(privateLedger.Burn(fromAddr, amount)) } -func Burn(address users.AddressOrName, amount uint64) { - caller := std.PrevRealm().Addr() - assertIsAdmin(caller) - tori.Burn(rusers.Resolve(address), amount) -} - -// render. -// - func Render(path string) string { parts := strings.Split(path, "/") c := len(parts) switch { case path == "": - return tori.RenderHome() - + return Token.RenderHome() case c == 2 && parts[0] == "balance": - owner := users.AddressOrName(parts[1]) - balance := tori.BalanceOf(rusers.Resolve(owner)) + owner := pusers.AddressOrName(parts[1]) + ownerAddr := users.Resolve(owner) + balance := UserTeller.BalanceOf(ownerAddr) return ufmt.Sprintf("%d\n", balance) - default: return "404\n" } } -func assertIsAdmin(address std.Address) { - if address != admin { - panic("restricted access") +func checkErr(err error) { + if err != nil { + panic(err) } } diff --git a/packages/context/WalletsProvider/gnotest/index.tsx b/packages/context/WalletsProvider/gnotest/index.tsx index 04ebacd001..f2adb988a9 100644 --- a/packages/context/WalletsProvider/gnotest/index.tsx +++ b/packages/context/WalletsProvider/gnotest/index.tsx @@ -146,7 +146,7 @@ const useGnotestStore = create((set, get) => ({ value: MsgSend.encode(msg).finish(), })), fee: { - gasFee: "1ugnot", + gasFee: "100000ugnot", gasWanted: Long.fromNumber(1000000), }, memo: "", @@ -177,7 +177,7 @@ const useGnotestStore = create((set, get) => ({ send, { gasWanted: Long.fromNumber(10000000), - gasFee: "1ugnot", + gasFee: "100000ugnot", }, ); @@ -191,7 +191,7 @@ const useGnotestStore = create((set, get) => ({ undefined, { gasWanted: Long.fromNumber(1000000), - gasFee: "1ugnot", + gasFee: "100000ugnot", }, ); await wallet.callMethod( @@ -202,7 +202,7 @@ const useGnotestStore = create((set, get) => ({ undefined, { gasWanted: Long.fromNumber(1000000), - gasFee: "1ugnot", + gasFee: "100000ugnot", }, ); await wallet.callMethod( @@ -213,7 +213,7 @@ const useGnotestStore = create((set, get) => ({ undefined, { gasWanted: Long.fromNumber(1000000), - gasFee: "1ugnot", + gasFee: "100000ugnot", }, ); } diff --git a/packages/screens/Projects/hooks/useEscrowContract.ts b/packages/screens/Projects/hooks/useEscrowContract.ts index bd1a391a80..839a38a369 100644 --- a/packages/screens/Projects/hooks/useEscrowContract.ts +++ b/packages/screens/Projects/hooks/useEscrowContract.ts @@ -63,7 +63,7 @@ export const useEscrowContract = ( func: string, args: string[], send: string = "", - gasWanted: number = 2_000_000, + gasWanted: number = 5_000_000, ) => { try { if (!networkId) { @@ -84,7 +84,7 @@ export const useEscrowContract = ( func, args, }, - { gasWanted }, + { gasWanted, gasFee: gasWanted / 10 }, ); return true; diff --git a/packages/utils/gno.ts b/packages/utils/gno.ts index de41e6fcda..124621bd21 100644 --- a/packages/utils/gno.ts +++ b/packages/utils/gno.ts @@ -36,8 +36,8 @@ export const adenaDoContract = async ( const height = await client.getBlockNumber(); const req: RequestDocontractMessage = { messages, - gasFee: opts?.gasFee === undefined ? 1 : opts.gasFee, - gasWanted: opts?.gasWanted === undefined ? 10000000 : opts.gasWanted, + gasFee: opts?.gasFee === undefined ? 2000000 : opts.gasFee, + gasWanted: opts?.gasWanted === undefined ? 20000000 : opts.gasWanted, memo: opts?.memo, }; const res = await adena.DoContract(req); diff --git a/packages/utils/gnodao/deploy.ts b/packages/utils/gnodao/deploy.ts index 385bfdda68..59c255e911 100644 --- a/packages/utils/gnodao/deploy.ts +++ b/packages/utils/gnodao/deploy.ts @@ -174,7 +174,7 @@ export const adenaDeployGnoDAO = async ( files: [{ name: `${conf.name}.gno`, body: source }], }, }, - { gasWanted: 20000000 }, + { gasWanted: 50000000, gasFee: 5000000 }, ); return pkgPath; }; From a47567151f9c411d6ec4d9198e28433dc033f5a0 Mon Sep 17 00:00:00 2001 From: Mikael VALLENET Date: Fri, 20 Dec 2024 18:27:52 +0100 Subject: [PATCH 09/20] feat: add permissions & voting power per roles per features (#1443) Signed-off-by: Norman Meier Co-authored-by: n0izn0iz Co-authored-by: Norman Meier --- gno/p/dao_core/dao_core.gno | 13 +- gno/p/dao_core/dao_core_test.gno | 8 +- gno/p/dao_interfaces/modules.gno | 5 +- .../dao_proposal_single.gno | 7 +- gno/p/dao_roles_group/roles_group.gno | 49 +++- gno/p/dao_roles_voting_group/gno.mod | 1 + gno/p/dao_roles_voting_group/messages.gno | 62 ++++ .../roles_voting_group.gno | 197 +++++++++++++ .../roles_voting_group_test.gno | 68 +++++ gno/p/dao_voting_group/voting_group.gno | 3 +- gno/p/role_manager/role_manager.gno | 2 +- gno/r/dao_realm/dao_realm.gno | 9 +- gno/r/dao_roles_realm.gno/dao_roles_realm.gno | 157 ++++++++++ .../dao_roles_realm_test.gno | 117 ++++++++ gno/r/dao_roles_realm.gno/gno.mod | 1 + networks.json | 1 + .../Checkbox.tsx} | 4 +- packages/hooks/dao/useDAOMember.ts | 2 +- packages/networks/gno-dev/index.ts | 1 + packages/networks/types.ts | 1 + .../screens/DAppStore/components/DAppBox.tsx | 5 +- .../screens/DAppStore/components/Dropdown.tsx | 4 +- .../Message/components/CheckboxGroup.tsx | 25 +- .../Message/components/CreateGroup.tsx | 6 +- .../MembershipOrg/MembershipDeployerSteps.tsx | 1 + .../RolesOrg/RolesDeployerSteps.tsx | 7 +- .../RolesOrg/RolesModalCreateRole.tsx | 98 +++++++ .../RolesReviewInformationSection.tsx | 4 +- .../RolesOrg/RolesSettingsSection.tsx | 271 ++++++++++++++---- .../TokenOrg/TokenDeployerSteps.tsx | 2 + packages/utils/gnodao/deploy.ts | 159 ++-------- .../gnodao/generateMembershipDAOSource.ts | 143 +++++++++ .../utils/gnodao/generateRolesDAOSource.ts | 159 ++++++++++ packages/utils/types/organizations.ts | 2 +- 34 files changed, 1356 insertions(+), 238 deletions(-) create mode 100644 gno/p/dao_roles_voting_group/gno.mod create mode 100644 gno/p/dao_roles_voting_group/messages.gno create mode 100644 gno/p/dao_roles_voting_group/roles_voting_group.gno create mode 100644 gno/p/dao_roles_voting_group/roles_voting_group_test.gno create mode 100644 gno/r/dao_roles_realm.gno/dao_roles_realm.gno create mode 100644 gno/r/dao_roles_realm.gno/dao_roles_realm_test.gno create mode 100644 gno/r/dao_roles_realm.gno/gno.mod rename packages/{screens/DAppStore/components/CheckboxDappStore.tsx => components/Checkbox.tsx} (90%) create mode 100644 packages/screens/Organizations/components/RolesOrg/RolesModalCreateRole.tsx create mode 100644 packages/utils/gnodao/generateMembershipDAOSource.ts create mode 100644 packages/utils/gnodao/generateRolesDAOSource.ts diff --git a/gno/p/dao_core/dao_core.gno b/gno/p/dao_core/dao_core.gno index 2f83fca06f..86f9d7126d 100644 --- a/gno/p/dao_core/dao_core.gno +++ b/gno/p/dao_core/dao_core.gno @@ -48,16 +48,17 @@ func NewDAOCore( proposalModules: make([]dao_interfaces.ActivableProposalModule, len(proposalModulesFactories)), } - core.votingModule = votingModuleFactory(core) - if core.votingModule == nil { - panic("voting module factory returned nil") - } - + // important to keep this order since voting module might depend on roles module core.rolesModule = rolesModuleFactory(core) if core.rolesModule == nil { panic("roles module factory returned nil") } + core.votingModule = votingModuleFactory(core) + if core.votingModule == nil { + panic("voting module factory returned nil") + } + for i, modFactory := range proposalModulesFactories { mod := modFactory(core) if mod == nil { @@ -157,7 +158,7 @@ func (d *daoCore) GetMembersJSON(start, end string, limit uint64, height int64) } func (d *daoCore) VotingPowerAtHeight(address std.Address, height int64) uint64 { - return d.VotingModule().VotingPowerAtHeight(address, height) + return d.VotingModule().VotingPowerAtHeight(address, height, []string{}) } func (d *daoCore) ActiveProposalModuleCount() int { diff --git a/gno/p/dao_core/dao_core_test.gno b/gno/p/dao_core/dao_core_test.gno index 4a879aacdd..2c1013d155 100644 --- a/gno/p/dao_core/dao_core_test.gno +++ b/gno/p/dao_core/dao_core_test.gno @@ -38,7 +38,7 @@ func (vm *votingModule) Render(path string) string { return "# Test Voting Module" } -func (vm *votingModule) VotingPowerAtHeight(address std.Address, height int64) uint64 { +func (vm *votingModule) VotingPowerAtHeight(address std.Address, height int64, resources []string) uint64 { return 0 } @@ -73,7 +73,7 @@ func (rm *rolesModule) HasRole(address std.Address, role string) bool { return false } -func (rm *rolesModule) NewRole(roleName string) { +func (rm *rolesModule) NewRoleJSON(roleName, resourcesJSON string) { panic("not implemented") } @@ -93,6 +93,10 @@ func (rm *rolesModule) GetMemberRoles(address std.Address) []string { return []string{} } +func (rm *rolesModule) GetMemberResourceVPower(address std.Address, resource string) uint64 { + return 0 +} + type proposalModule struct { core dao_interfaces.IDAOCore } diff --git a/gno/p/dao_interfaces/modules.gno b/gno/p/dao_interfaces/modules.gno index d5b4d7c3a5..5565d9537a 100644 --- a/gno/p/dao_interfaces/modules.gno +++ b/gno/p/dao_interfaces/modules.gno @@ -18,7 +18,7 @@ type IVotingModule interface { ConfigJSON() string GetMembersJSON(start, end string, limit uint64, height int64) string Render(path string) string - VotingPowerAtHeight(address std.Address, height int64) (power uint64) + VotingPowerAtHeight(address std.Address, height int64, resources []string) (power uint64) TotalPowerAtHeight(height int64) uint64 } @@ -43,8 +43,9 @@ type IRolesModule interface { ConfigJSON() string Render(path string) string GetMemberRoles(address std.Address) []string + GetMemberResourceVPower(address std.Address, resource string) uint64 HasRole(address std.Address, role string) bool - NewRole(roleName string) + NewRoleJSON(roleName, resourcesJSON string) DeleteRole(roleName string) GrantRole(address std.Address, role string) RevokeRole(address std.Address, role string) diff --git a/gno/p/dao_proposal_single/dao_proposal_single.gno b/gno/p/dao_proposal_single/dao_proposal_single.gno index d95d33cf00..19f68130ec 100644 --- a/gno/p/dao_proposal_single/dao_proposal_single.gno +++ b/gno/p/dao_proposal_single/dao_proposal_single.gno @@ -331,7 +331,12 @@ func (d *DAOProposalSingle) VoteJSON(proposalID int, voteJSON string) { panic("proposal is expired") } - votePower := d.core.VotingModule().VotingPowerAtHeight(voter, proposal.StartHeight) + resources := make([]string, len(proposal.Messages)) + for i, m := range proposal.Messages { + resources[i] = m.Type() + } + + votePower := d.core.VotingModule().VotingPowerAtHeight(voter, proposal.StartHeight, resources) if votePower == 0 { panic("not registered") } diff --git a/gno/p/dao_roles_group/roles_group.gno b/gno/p/dao_roles_group/roles_group.gno index e10f45a40f..c7d81ece48 100644 --- a/gno/p/dao_roles_group/roles_group.gno +++ b/gno/p/dao_roles_group/roles_group.gno @@ -3,6 +3,7 @@ package dao_roles_group import ( "std" + "gno.land/p/demo/avl" "gno.land/p/demo/json" dao_interfaces "gno.land/p/teritori/dao_interfaces" "gno.land/p/teritori/jsonutil" @@ -12,12 +13,19 @@ import ( type RolesGroup struct { dao_interfaces.IRolesModule - rm *role_manager.RoleManager + rm *role_manager.RoleManager + resourcesVPower *avl.Tree // roles -> ResourceVPower[] +} + +type ResourceVPower struct { + Resource string + Power uint64 } func NewRolesGroup() *RolesGroup { return &RolesGroup{ - rm: role_manager.NewWithAddress(std.PrevRealm().Addr()), + rm: role_manager.NewWithAddress(std.PrevRealm().Addr()), + resourcesVPower: avl.NewTree(), } } @@ -42,8 +50,25 @@ func (r *RolesGroup) HasRole(address std.Address, role string) bool { return r.rm.HasRole(address, role) } -func (r *RolesGroup) NewRole(roleName string) { +func (r *RolesGroup) NewRoleJSON(roleName, resourcesJSON string) { + node := json.Must(json.Unmarshal([]byte(resourcesJSON))) + arr := node.MustArray() + resources := make([]ResourceVPower, len(arr)) + for i, n := range arr { + node := n.MustObject() + resources[i] = ResourceVPower{ + Resource: node["resource"].MustString(), + Power: jsonutil.MustUint64(node["power"]), + } + } + r.NewRole(roleName, resources) +} + +func (r *RolesGroup) NewRole(roleName string, resources []ResourceVPower) { r.rm.CreateNewRole(roleName, []string{}) + if len(resources) > 0 { + r.resourcesVPower.Set(roleName, resources) + } } func (r *RolesGroup) DeleteRole(roleName string) { @@ -61,3 +86,21 @@ func (r *RolesGroup) RevokeRole(address std.Address, role string) { func (r *RolesGroup) GetMemberRoles(address std.Address) []string { return r.rm.GetUserRoles(address) } + +func (r *RolesGroup) GetMemberResourceVPower(address std.Address, resource string) uint64 { + roles := r.rm.GetUserRoles(address) + power := uint64(0) + for _, role := range roles { + resourcesRaw, exists := r.resourcesVPower.Get(role) + if !exists { + continue + } + resources := resourcesRaw.([]ResourceVPower) + for _, r := range resources { + if r.Resource == resource && r.Power > power { + power = r.Power + } + } + } + return power +} diff --git a/gno/p/dao_roles_voting_group/gno.mod b/gno/p/dao_roles_voting_group/gno.mod new file mode 100644 index 0000000000..f782e5d8be --- /dev/null +++ b/gno/p/dao_roles_voting_group/gno.mod @@ -0,0 +1 @@ +module gno.land/p/teritori/dao_roles_voting_group diff --git a/gno/p/dao_roles_voting_group/messages.gno b/gno/p/dao_roles_voting_group/messages.gno new file mode 100644 index 0000000000..39b5874b3f --- /dev/null +++ b/gno/p/dao_roles_voting_group/messages.gno @@ -0,0 +1,62 @@ +package dao_roles_voting_group + +import ( + "gno.land/p/demo/json" + "gno.land/p/teritori/dao_interfaces" +) + +const updateMembersType = "gno.land/p/teritori/dao_voting_group.UpdateMembers" + +type UpdateMembersExecutableMessage []Member + +var _ dao_interfaces.ExecutableMessage = (*UpdateMembersExecutableMessage)(nil) + +func (m *UpdateMembersExecutableMessage) FromJSON(ast *json.Node) { + changes := ast.MustArray() + *m = make([]Member, len(changes)) + for i, change := range changes { + (*m)[i].FromJSON(change) + } +} + +func (m *UpdateMembersExecutableMessage) ToJSON() *json.Node { + changes := make([]*json.Node, len(*m)) + for i, change := range *m { + changes[i] = change.ToJSON() + } + + return json.ArrayNode("", changes) +} + +func (m *UpdateMembersExecutableMessage) String() string { + return m.ToJSON().String() +} + +func (m *UpdateMembersExecutableMessage) Type() string { + return updateMembersType +} + +type updateMembersHandler struct { + vg *RolesVotingGroup +} + +var _ dao_interfaces.MessageHandler = (*updateMembersHandler)(nil) + +func (h *updateMembersHandler) Type() string { + return updateMembersType +} + +func (h *updateMembersHandler) Execute(msg dao_interfaces.ExecutableMessage) { + m, ok := msg.(*UpdateMembersExecutableMessage) + if !ok { + panic("unexpected message type") + } + + for _, change := range *m { + h.vg.SetMemberPower(change.Address, change.Power) + } +} + +func (h *updateMembersHandler) Instantiate() dao_interfaces.ExecutableMessage { + return &UpdateMembersExecutableMessage{} +} diff --git a/gno/p/dao_roles_voting_group/roles_voting_group.gno b/gno/p/dao_roles_voting_group/roles_voting_group.gno new file mode 100644 index 0000000000..40f728cb19 --- /dev/null +++ b/gno/p/dao_roles_voting_group/roles_voting_group.gno @@ -0,0 +1,197 @@ +package dao_roles_voting_group + +import ( + "std" + "strconv" + "strings" + + "gno.land/p/demo/json" + dao_interfaces "gno.land/p/teritori/dao_interfaces" + "gno.land/p/teritori/havl" + "gno.land/p/teritori/jsonutil" +) + +type Member struct { + Address std.Address + Power uint64 +} + +func (m Member) ToJSON() *json.Node { + return json.ObjectNode("", map[string]*json.Node{ + "address": jsonutil.AddressNode(m.Address), + "power": jsonutil.Uint64Node(m.Power), + }) +} + +func (m *Member) FromJSON(ast *json.Node) { + obj := ast.MustObject() + m.Address = jsonutil.MustAddress(obj["address"]) + m.Power = jsonutil.MustUint64(obj["power"]) +} + +type RolesVotingGroup struct { + dao_interfaces.IVotingModule + + powerByAddr *havl.Tree // std.Address -> uint64 + totalPower *havl.Tree // "" -> uint64 + memberCount *havl.Tree // "" -> uint32 + rolesModule dao_interfaces.IRolesModule +} + +func NewRolesVotingGroup(rm dao_interfaces.IRolesModule) *RolesVotingGroup { + return &RolesVotingGroup{ + powerByAddr: havl.NewTree(), + totalPower: havl.NewTree(), + memberCount: havl.NewTree(), + rolesModule: rm, + } +} + +func (v *RolesVotingGroup) Info() dao_interfaces.ModuleInfo { + return dao_interfaces.ModuleInfo{ + Kind: "gno.land/p/teritori/dao_voting_group", + Version: "0.1.0", + } +} + +func (v *RolesVotingGroup) ConfigJSON() string { + return json.ObjectNode("", map[string]*json.Node{ + "totalPower": jsonutil.Uint64Node(v.TotalPowerAtHeight(havl.Latest)), + "members": jsonutil.Uint32Node(v.MemberCount(havl.Latest)), + }).String() +} + +func (v *RolesVotingGroup) GetMembersJSON(start, end string, limit uint64, height int64) string { + members := v.GetMembers(start, end, limit, height) + membersJSON := make([]*json.Node, len(members)) + for i, m := range members { + membersJSON[i] = m.ToJSON() + } + return json.ArrayNode("", membersJSON).String() +} + +func (v *RolesVotingGroup) VotingPowerAtHeight(addr std.Address, height int64, resources []string) uint64 { + userPower, ok := v.powerByAddr.Get(addr.String(), height) + if !ok { + return 0 + } + + // In case there is many resources involved, we take the lowest value + rolePower := uint64(0) + for _, resource := range resources { + tmp := v.rolesModule.GetMemberResourceVPower(addr, resource) + if tmp < rolePower || rolePower == 0 { + rolePower = tmp + } + } + + if rolePower > userPower.(uint64) { + return rolePower + } + + return userPower.(uint64) +} + +func (v *RolesVotingGroup) TotalPowerAtHeight(height int64) uint64 { + p, ok := v.totalPower.Get("", height) + if !ok { + return 0 + } + + return p.(uint64) +} + +func (g *RolesVotingGroup) SetMemberPower(addr std.Address, power uint64) { + if power == 0 { + g.RemoveMember(addr) + return + } + + iprevious, ok := g.powerByAddr.Get(addr.String(), havl.Latest) + if !ok { + g.memberCount.Set("", g.MemberCount(havl.Latest)+1) + } + + previous := uint64(0) + if ok { + previous = iprevious.(uint64) + } + + if power == previous { + return + } + + g.powerByAddr.Set(addr.String(), power) + + ipreviousTotal, ok := g.totalPower.Get("", havl.Latest) + previousTotal := uint64(0) + if ok { + previousTotal = ipreviousTotal.(uint64) + } + + g.totalPower.Set("", (previousTotal+power)-previous) +} + +func (g *RolesVotingGroup) RemoveMember(addr std.Address) (uint64, bool) { + p, removed := g.powerByAddr.Remove(addr.String()) + if !removed { + return 0, false + } + + g.memberCount.Set("", g.MemberCount(havl.Latest)-1) + power := p.(uint64) + g.totalPower.Set("", g.TotalPowerAtHeight(havl.Latest)-power) + return power, true +} + +func (g *RolesVotingGroup) UpdateMembersHandler() dao_interfaces.MessageHandler { + return &updateMembersHandler{vg: g} +} + +func (g *RolesVotingGroup) MemberCount(height int64) uint32 { + val, ok := g.memberCount.Get("", height) + if !ok { + return 0 + } + + return val.(uint32) +} + +func (g *RolesVotingGroup) GetMembers(start, end string, limit uint64, height int64) []Member { + var members []Member + g.powerByAddr.Iterate(start, end, height, func(k string, v interface{}) bool { + if limit > 0 && uint64(len(members)) >= limit { + return true + } + + members = append(members, Member{ + Address: std.Address(k), + Power: v.(uint64), + }) + + return false + }) + return members +} + +func (v *RolesVotingGroup) Render(path string) string { + sb := strings.Builder{} + sb.WriteString("Member count: ") + sb.WriteString(strconv.FormatUint(uint64(v.MemberCount(havl.Latest)), 10)) + sb.WriteString("\n\n") + sb.WriteString("Total power: ") + sb.WriteString(strconv.FormatUint(v.TotalPowerAtHeight(havl.Latest), 10)) + sb.WriteString("\n\n") + sb.WriteString("Members:\n") + v.powerByAddr.Iterate("", "", havl.Latest, func(k string, v interface{}) bool { + sb.WriteString("- ") + sb.WriteString(k) + sb.WriteString(": ") + sb.WriteString(strconv.FormatUint(v.(uint64), 10)) + sb.WriteRune('\n') + return false + }) + + sb.WriteRune('\n') + return sb.String() +} diff --git a/gno/p/dao_roles_voting_group/roles_voting_group_test.gno b/gno/p/dao_roles_voting_group/roles_voting_group_test.gno new file mode 100644 index 0000000000..39eb14d08a --- /dev/null +++ b/gno/p/dao_roles_voting_group/roles_voting_group_test.gno @@ -0,0 +1,68 @@ +package dao_roles_voting_group + +import ( + "testing" + + "gno.land/p/demo/testutils" + dao_interfaces "gno.land/p/teritori/dao_interfaces" + "gno.land/p/teritori/dao_roles_group" +) + +var ( + alice = testutils.TestAddress("alice") + bob = testutils.TestAddress("bob") +) + +func TestRolesVotingGroup(t *testing.T) { + rm := dao_roles_group.NewRolesGroup() + var j dao_interfaces.IRolesModule + j = rm + rv := NewRolesVotingGroup(j) + var i dao_interfaces.IVotingModule + i = rv + + { + got := i.TotalPowerAtHeight(0) + expected := uint64(0) + if got != expected { + t.Fatalf("expected %s, got %s.", expected, got) + } + } + + { + conf := rv.ConfigJSON() + expected := `{"totalPower":"0","members":"0"}` + if conf != expected { + t.Fatalf("expected %s, got %s.", expected, conf) + } + } + + rv.SetMemberPower(alice, 1) + + { + got := i.TotalPowerAtHeight(0) + expected := uint64(1) + if got != expected { + t.Fatalf("expected %s, got %s.", expected, got) + } + } + + j.NewRoleJSON("role1", `[ + {"resource": "resource1", "power": "2"} + ]`) + j.GrantRole(alice, "role1") + + { + got := i.VotingPowerAtHeight(alice, 0, []string{"resource1"}) + expected := uint64(2) + if got != expected { + t.Fatalf("expected %s, got %s.", expected, got) + } + + got = i.VotingPowerAtHeight(alice, 0, []string{"resource2"}) + expected = uint64(1) + if got != expected { + t.Fatalf("expected %s, got %s.", expected, got) + } + } +} diff --git a/gno/p/dao_voting_group/voting_group.gno b/gno/p/dao_voting_group/voting_group.gno index c76de71175..753d8a12c5 100644 --- a/gno/p/dao_voting_group/voting_group.gno +++ b/gno/p/dao_voting_group/voting_group.gno @@ -68,7 +68,8 @@ func (v *VotingGroup) GetMembersJSON(start, end string, limit uint64, height int return json.ArrayNode("", membersJSON).String() } -func (v *VotingGroup) VotingPowerAtHeight(addr std.Address, height int64) uint64 { +func (v *VotingGroup) VotingPowerAtHeight(addr std.Address, height int64, resources []string) uint64 { + _ = resources p, ok := v.powerByAddr.Get(addr.String(), height) if !ok { return 0 diff --git a/gno/p/role_manager/role_manager.gno b/gno/p/role_manager/role_manager.gno index 7a7b91a0d8..71a09226c0 100644 --- a/gno/p/role_manager/role_manager.gno +++ b/gno/p/role_manager/role_manager.gno @@ -163,7 +163,7 @@ func (rm *RoleManager) HasRole(user std.Address, roleName string) bool { return userRoles.Has(roleName) } -func (rm *RoleManager) IsRoleExist(roleName string) bool { +func (rm *RoleManager) RoleExists(roleName string) bool { return rm.roles.Has(roleName) } diff --git a/gno/r/dao_realm/dao_realm.gno b/gno/r/dao_realm/dao_realm.gno index b45ee65012..fc2d028149 100644 --- a/gno/r/dao_realm/dao_realm.gno +++ b/gno/r/dao_realm/dao_realm.gno @@ -1,5 +1,7 @@ package dao_realm +// TODO: Create two dao_realm example: Membership based & Roles based + import ( "std" "time" @@ -38,13 +40,6 @@ func init() { rolesModuleFactory := func(core dao_interfaces.IDAOCore) dao_interfaces.IRolesModule { roles = dao_roles_group.NewRolesGroup() - roles.NewRole("admin") - roles.NewRole("moderator") - roles.NewRole("member") - roles.GrantRole("g1747t5m2f08plqjlrjk2q0qld7465hxz8gkx59c", "admin") - roles.GrantRole("g108cszmcvs4r3k67k7h5zuhm4el3qhlrxzhshtv", "moderator") - roles.GrantRole("g14u5eaheavy0ux4dmpykg2gvxpvqvexm9cyg58a", "member") - roles.GrantRole("g1ckn395mpttp0vupgtratyufdaakgh8jgkmr3ym", "member") return roles } diff --git a/gno/r/dao_roles_realm.gno/dao_roles_realm.gno b/gno/r/dao_roles_realm.gno/dao_roles_realm.gno new file mode 100644 index 0000000000..6319c3ff6b --- /dev/null +++ b/gno/r/dao_roles_realm.gno/dao_roles_realm.gno @@ -0,0 +1,157 @@ +package dao_roles_realm + +// TODO: Create two dao_realm example: Membership based & Roles based + +import ( + "std" + "time" + + dao_core "gno.land/p/teritori/dao_core" + dao_interfaces "gno.land/p/teritori/dao_interfaces" + proposal_single "gno.land/p/teritori/dao_proposal_single" + "gno.land/p/teritori/dao_roles_group" + roles_voting_group "gno.land/p/teritori/dao_roles_voting_group" + "gno.land/p/teritori/dao_utils" + "gno.land/r/demo/profile" + "gno.land/r/teritori/dao_registry" + "gno.land/r/teritori/social_feeds" + "gno.land/r/teritori/tori" +) + +// Example DAO realm + +var ( + daoCore dao_interfaces.IDAOCore + group *roles_voting_group.RolesVotingGroup + roles *dao_roles_group.RolesGroup + registered bool +) + +func init() { + rolesModuleFactory := func(core dao_interfaces.IDAOCore) dao_interfaces.IRolesModule { + roles = dao_roles_group.NewRolesGroup() + roles.NewRoleJSON("admin", "[{\"resource\": \"social_feed\", \"power\": \"25\"}, {\"resource\": \"organizations\", \"power\": \"100\"}]") + roles.NewRoleJSON("moderator", "[{\"resource\": \"social_feed\", \"power\": \"10\"}]") + roles.NewRoleJSON("member", "[]") + roles.GrantRole("g1747t5m2f08plqjlrjk2q0qld7465hxz8gkx59c", "admin") + roles.GrantRole("g108cszmcvs4r3k67k7h5zuhm4el3qhlrxzhshtv", "moderator") + roles.GrantRole("g14u5eaheavy0ux4dmpykg2gvxpvqvexm9cyg58a", "member") + roles.GrantRole("g1ckn395mpttp0vupgtratyufdaakgh8jgkmr3ym", "member") + return roles + } + + votingModuleFactory := func(core dao_interfaces.IDAOCore) dao_interfaces.IVotingModule { + group = roles_voting_group.NewRolesVotingGroup(core.RolesModule()) + group.SetMemberPower("g1747t5m2f08plqjlrjk2q0qld7465hxz8gkx59c", 1) + group.SetMemberPower("g108cszmcvs4r3k67k7h5zuhm4el3qhlrxzhshtv", 1) + group.SetMemberPower("g14u5eaheavy0ux4dmpykg2gvxpvqvexm9cyg58a", 1) + group.SetMemberPower("g1ckn395mpttp0vupgtratyufdaakgh8jgkmr3ym", 1) + group.SetMemberPower(std.GetOrigCaller(), 1) + return group + } + + // TODO: consider using factories that return multiple modules and handlers + + proposalModulesFactories := []dao_interfaces.ProposalModuleFactory{ + func(core dao_interfaces.IDAOCore) dao_interfaces.IProposalModule { + tt := proposal_single.PercentageThresholdPercent(100) + tq := proposal_single.PercentageThresholdPercent(100) + return proposal_single.NewDAOProposalSingle(core, &proposal_single.DAOProposalSingleOpts{ + MaxVotingPeriod: dao_utils.DurationTime(time.Hour * 24 * 42), + Threshold: &proposal_single.ThresholdThresholdQuorum{ + Threshold: &tt, // 1% + Quorum: &tq, // 1% + }, + }) + }, + } + + messageHandlersFactories := []dao_interfaces.MessageHandlerFactory{ + func(core dao_interfaces.IDAOCore) dao_interfaces.MessageHandler { + return group.UpdateMembersHandler() + }, + func(core dao_interfaces.IDAOCore) dao_interfaces.MessageHandler { + // TODO: add a router to support multiple proposal modules + propMod := core.ProposalModules()[0] + return proposal_single.NewUpdateSettingsHandler(propMod.Module.(*proposal_single.DAOProposalSingle)) + }, + func(core dao_interfaces.IDAOCore) dao_interfaces.MessageHandler { + return tori.NewMintToriHandler() + }, + func(core dao_interfaces.IDAOCore) dao_interfaces.MessageHandler { + return tori.NewBurnToriHandler() + }, + func(core dao_interfaces.IDAOCore) dao_interfaces.MessageHandler { + return tori.NewChangeAdminHandler() + }, + func(core dao_interfaces.IDAOCore) dao_interfaces.MessageHandler { + return social_feeds.NewCreatePostHandler() + }, + } + + daoCore = dao_core.NewDAOCore(votingModuleFactory, rolesModuleFactory, proposalModulesFactories, messageHandlersFactories) + + // Register the DAO profile + profile.SetStringField(profile.DisplayName, "DAO Realm") + profile.SetStringField(profile.Bio, "Default testing DAO") + profile.SetStringField(profile.Avatar, "") + + // dao_registry.Register(func() dao_interfaces.IDAOCore { return daoCore }, "DAO Realm", "Default testing DAO", "https://images.unsplash.com/photo-1477959858617-67f85cf4f1df?w=1080&fit=max") +} + +// FIXME: the registry is currently broken in 'gno test', see https://github.com/gnolang/gno/issues/1852 +// so we're exposing a way to register after DAO instantiation +func RegisterSelf() { + if registered { + panic("already registered") + } + + dao_registry.Register(func() dao_interfaces.IDAOCore { return daoCore }, "DAO Realm", "Default testing DAO", "https://images.unsplash.com/photo-1477959858617-67f85cf4f1df?w=1080&fit=max") + registered = true +} + +func Render(path string) string { + return daoCore.Render(path) +} + +func VoteJSON(moduleIndex int, proposalID int, voteJSON string) { + // move check in dao core + module := dao_core.GetProposalModule(daoCore, moduleIndex) + if !module.Enabled { + panic("proposal module is not enabled") + } + + module.Module.VoteJSON(proposalID, voteJSON) +} + +func Execute(moduleIndex int, proposalID int) { + // move check in dao core + module := dao_core.GetProposalModule(daoCore, moduleIndex) + if !module.Enabled { + panic("proposal module is not enabled") + } + + module.Module.Execute(proposalID) +} + +func ProposeJSON(moduleIndex int, proposalJSON string) int { + // move check in dao core + module := dao_core.GetProposalModule(daoCore, moduleIndex) + if !module.Enabled { + panic("proposal module is not enabled") + } + + return module.Module.ProposeJSON(proposalJSON) +} + +func getProposalsJSON(moduleIndex int, limit int, startAfter string, reverse bool) string { + // move logic in dao core + module := dao_core.GetProposalModule(daoCore, moduleIndex) + return module.Module.ProposalsJSON(limit, startAfter, reverse) +} + +func getProposalJSON(moduleIndex int, proposalIndex int) string { + // move logic in dao core + module := dao_core.GetProposalModule(daoCore, moduleIndex) + return module.Module.ProposalJSON(proposalIndex) +} diff --git a/gno/r/dao_roles_realm.gno/dao_roles_realm_test.gno b/gno/r/dao_roles_realm.gno/dao_roles_realm_test.gno new file mode 100644 index 0000000000..aa817a27a9 --- /dev/null +++ b/gno/r/dao_roles_realm.gno/dao_roles_realm_test.gno @@ -0,0 +1,117 @@ +package dao_roles_realm + +import ( + "fmt" + "testing" + + "gno.land/p/demo/json" + "gno.land/p/teritori/dao_voting_group" + "gno.land/p/teritori/havl" +) + +func TestInit(t *testing.T) { + { + proposalsJSON := getProposalsJSON(0, 42, "TODO", false) + expected := `[]` + if proposalsJSON != expected { + t.Fatalf("Expected %s, got %s", expected, proposalsJSON) + } + } + + { + members := group.GetMembers("", "", 0, havl.Latest) + iSlice := make([]*json.Node, len(members)) + for i, v := range members { + iSlice[i] = v.ToJSON() + } + + membersJSON := json.ArrayNode("", iSlice).String() + expected := `[{"address":"g108cszmcvs4r3k67k7h5zuhm4el3qhlrxzhshtv","power":"1"},{"address":"g14u5eaheavy0ux4dmpykg2gvxpvqvexm9cyg58a","power":"1"},{"address":"g1747t5m2f08plqjlrjk2q0qld7465hxz8gkx59c","power":"1"},{"address":"g1ckn395mpttp0vupgtratyufdaakgh8jgkmr3ym","power":"1"},{"address":"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm","power":"1"}]` + if membersJSON != expected { + t.Fatalf("Expected:\n%s\nGot:\n%s", expected, membersJSON) + } + } +} + +func TestUpdateMembers(t *testing.T) { + var membersJSON string + + { + id := ProposeJSON(0, fmt.Sprintf(`{"title": "Test prop", "description": "A description", "messages": [{"type": "gno.land/p/teritori/dao_voting_group.UpdateMembers", "payload": [{"power": "2", "address": "g18syxa0vh0vmne90mwhtynjet0zgeqf6prh3ryy"}]}]}`)) + VoteJSON(0, id, `{"vote": "Yes", "rationale": "testing"}`) + Execute(0, id) + members := group.GetMembers("", "", 0, havl.Latest) + iSlice := make([]*json.Node, len(members)) + for i, v := range members { + iSlice[i] = v.ToJSON() + } + + membersJSON = json.ArrayNode("", iSlice).String() + expected := fmt.Sprintf(`[{"address":"g108cszmcvs4r3k67k7h5zuhm4el3qhlrxzhshtv","power":"1"},{"address":"g14u5eaheavy0ux4dmpykg2gvxpvqvexm9cyg58a","power":"1"},{"address":"g1747t5m2f08plqjlrjk2q0qld7465hxz8gkx59c","power":"1"},{"address":"g18syxa0vh0vmne90mwhtynjet0zgeqf6prh3ryy","power":"2"},{"address":"g1ckn395mpttp0vupgtratyufdaakgh8jgkmr3ym","power":"1"},{"address":"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm","power":"1"}]`) + if membersJSON != expected { + t.Errorf("Expected:\n%s\nGot:\n%s", expected, membersJSON) + } + + totalPower := group.TotalPowerAtHeight(havl.Latest) + if totalPower != 7 { + t.Errorf("Expected total power to be 6, got %d", totalPower) + } + } + + { + children := json.Must(json.Unmarshal([]byte(membersJSON))).MustArray() + if len(children) != 6 { + t.Errorf("Expected 6 members, got %d", len(children)) + } + + var member dao_voting_group.Member + member.FromJSON(children[0]) + + id := ProposeJSON(0, fmt.Sprintf(`{"title": "Test prop 2", "description": "A description", "messages": [{"type": "gno.land/p/teritori/dao_voting_group.UpdateMembers", "payload": [{"address": "%s", "power": "0"}]}]}`, member.Address.String())) + VoteJSON(0, id, `{"vote": "Yes", "rationale": "testing"}`) + Execute(0, id) + members := group.GetMembers("", "", 0, havl.Latest) + iSlice := make([]*json.Node, len(members)) + for i, v := range members { + iSlice[i] = v.ToJSON() + } + + membersJSON := json.ArrayNode("", iSlice).String() + expected := `[{"address":"g14u5eaheavy0ux4dmpykg2gvxpvqvexm9cyg58a","power":"1"},{"address":"g1747t5m2f08plqjlrjk2q0qld7465hxz8gkx59c","power":"1"},{"address":"g18syxa0vh0vmne90mwhtynjet0zgeqf6prh3ryy","power":"2"},{"address":"g1ckn395mpttp0vupgtratyufdaakgh8jgkmr3ym","power":"1"},{"address":"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm","power":"1"}]` + if membersJSON != expected { + t.Errorf("Expected:\n%s\nGot:\n%s", expected, membersJSON) + } + + totalPower := group.TotalPowerAtHeight(havl.Latest) + if totalPower != 6 { + t.Errorf("Expected total power to be 6, got %d", totalPower) + } + } +} + +func TestUpdateSettings(t *testing.T) { + // not sure why but in this test the proposal ids start at 3 and the voting power is 5 when all tests are run, shouldn't tests be isolated? TODO: investigate + + { + id := ProposeJSON(0, fmt.Sprintf(`{"title": "Test prop", "description": "A description", "messages": [{"type": "gno.land/p/teritori/dao_proposal_single.UpdateSettings", "payload": {"threshold": {"thresholdQuorum": {"threshold": {"percent": 200}, "quorum": {"percent": 200}}}}}]}`)) + VoteJSON(0, id, `{"vote": "Yes", "rationale": "testing"}`) + Execute(0, id) + proposalJSON := getProposalJSON(0, id) + expected := fmt.Sprintf(`{"id":"%d","title":"Test prop","description":"A description","proposer":"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm","startHeight":"123","totalPower":"6","messages":[{"type":"gno.land/p/teritori/dao_proposal_single.UpdateSettings","payload":{"threshold":{"thresholdQuorum":{"threshold":{"percent":200},"quorum":{"percent":200}}}}}],"status":"Executed","votes":{"yes":"1","no":"0","abstain":"0"},"allowRevoting":false,"ballots":{"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm":{"power":"1","vote":"Yes","rationale":"testing"}},"expiration":{"atTime":"2009-03-27T23:31:30Z"},"threshold":{"thresholdQuorum":{"threshold":{"percent":100},"quorum":{"percent":100}}}}`, id) + if proposalJSON != expected { + t.Fatalf("Expected:\n%s\nGot:\n%s", expected, proposalJSON) + } + } + + { + // make sentiment proposal + id := ProposeJSON(0, fmt.Sprintf(`{"title": "Test prop", "description": "A description", "messages": []}`)) + VoteJSON(0, id, `{"vote": "Yes", "rationale": "testing"}`) + Execute(0, id) + proposalJSON := getProposalJSON(0, id) + expected := fmt.Sprintf(`{"id":"%d","title":"Test prop","description":"A description","proposer":"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm","startHeight":"123","totalPower":"6","messages":[],"status":"Executed","votes":{"yes":"1","no":"0","abstain":"0"},"allowRevoting":false,"ballots":{"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm":{"power":"1","vote":"Yes","rationale":"testing"}},"expiration":{"atTime":"2009-03-27T23:31:30Z"},"threshold":{"thresholdQuorum":{"threshold":{"percent":200},"quorum":{"percent":200}}}}`, id) + if proposalJSON != expected { + t.Fatalf("Expected:\n%s\nGot:\n%s", expected, proposalJSON) + } + } +} diff --git a/gno/r/dao_roles_realm.gno/gno.mod b/gno/r/dao_roles_realm.gno/gno.mod new file mode 100644 index 0000000000..8dbe10f69f --- /dev/null +++ b/gno/r/dao_roles_realm.gno/gno.mod @@ -0,0 +1 @@ +module gno.land/r/teritori/dao_roles_realm diff --git a/networks.json b/networks.json index 6f7eb497f6..f0a178c5a8 100644 --- a/networks.json +++ b/networks.json @@ -4522,6 +4522,7 @@ "modboardsPkgPath": "gno.land/r/teritori/modboards", "groupsPkgPath": "gno.land/r/teritori/groups", "votingGroupPkgPath": "gno.land/p/teritori/dao_voting_group", + "rolesVotingGroupPkgPath": "gno.land/p/teritori/dao_roles_voting_group", "rolesGroupPkgPath": "gno.land/p/teritori/dao_roles_group", "daoProposalSinglePkgPath": "gno.land/p/teritori/dao_proposal_single", "profilePkgPath": "gno.land/r/demo/profile", diff --git a/packages/screens/DAppStore/components/CheckboxDappStore.tsx b/packages/components/Checkbox.tsx similarity index 90% rename from packages/screens/DAppStore/components/CheckboxDappStore.tsx rename to packages/components/Checkbox.tsx index 7a83f31192..883883936f 100644 --- a/packages/screens/DAppStore/components/CheckboxDappStore.tsx +++ b/packages/components/Checkbox.tsx @@ -1,6 +1,6 @@ import { StyleProp, StyleSheet, View, ViewStyle } from "react-native"; -import checkSVG from "../../../../assets/icons/check.svg"; +import checkSVG from "../../assets/icons/check.svg"; import { SVG } from "@/components/SVG"; import { @@ -10,7 +10,7 @@ import { secondaryColor, } from "@/utils/style/colors"; -export const CheckboxDappStore: React.FC<{ +export const Checkbox: React.FC<{ isChecked?: boolean; style?: StyleProp; }> = ({ isChecked = false, style }) => { diff --git a/packages/hooks/dao/useDAOMember.ts b/packages/hooks/dao/useDAOMember.ts index 930034946d..57fceef3f6 100644 --- a/packages/hooks/dao/useDAOMember.ts +++ b/packages/hooks/dao/useDAOMember.ts @@ -52,7 +52,7 @@ const useDAOMember = ( const power = extractGnoNumber( await provider.evaluateExpression( packagePath, - `daoCore.VotingModule().VotingPowerAtHeight("${userAddress}", 0)`, + `daoCore.VotingModule().VotingPowerAtHeight("${userAddress}", 0, []string{})`, 0, ), ); diff --git a/packages/networks/gno-dev/index.ts b/packages/networks/gno-dev/index.ts index 1e8556e8b7..29032c6aa4 100644 --- a/packages/networks/gno-dev/index.ts +++ b/packages/networks/gno-dev/index.ts @@ -45,6 +45,7 @@ export const gnoDevNetwork: GnoNetworkInfo = { modboardsPkgPath: "gno.land/r/teritori/modboards", groupsPkgPath: "gno.land/r/teritori/groups", votingGroupPkgPath: "gno.land/p/teritori/dao_voting_group", + rolesVotingGroupPkgPath: "gno.land/p/teritori/dao_roles_voting_group", rolesGroupPkgPath: "gno.land/p/teritori/dao_roles_group", daoProposalSinglePkgPath: "gno.land/p/teritori/dao_proposal_single", profilePkgPath: "gno.land/r/demo/profile", diff --git a/packages/networks/types.ts b/packages/networks/types.ts index 3167b7dae4..35c4d63c0b 100644 --- a/packages/networks/types.ts +++ b/packages/networks/types.ts @@ -114,6 +114,7 @@ export type GnoNetworkInfo = NetworkInfoBase & { socialFeedsPkgPath?: string; socialFeedsDAOPkgPath?: string; votingGroupPkgPath?: string; + rolesVotingGroupPkgPath?: string; rolesGroupPkgPath?: string; daoProposalSinglePkgPath?: string; daoInterfacesPkgPath?: string; diff --git a/packages/screens/DAppStore/components/DAppBox.tsx b/packages/screens/DAppStore/components/DAppBox.tsx index f3537f1e23..dadb4d27f5 100644 --- a/packages/screens/DAppStore/components/DAppBox.tsx +++ b/packages/screens/DAppStore/components/DAppBox.tsx @@ -2,9 +2,8 @@ import React, { useEffect, useState } from "react"; import { Pressable, StyleProp, View } from "react-native"; import { useSelector } from "react-redux"; -import { CheckboxDappStore } from "./CheckboxDappStore"; - import { BrandText } from "@/components/BrandText"; +import { Checkbox } from "@/components/Checkbox"; import { SVGorImageIcon } from "@/components/SVG/SVGorImageIcon"; import { Box, BoxStyle } from "@/components/boxes/Box"; import { selectCheckedApps, setCheckedApp } from "@/store/slices/dapps-store"; @@ -95,7 +94,7 @@ export const DAppBox: React.FC<{ - {!alwaysOn && } + {!alwaysOn && } ); diff --git a/packages/screens/DAppStore/components/Dropdown.tsx b/packages/screens/DAppStore/components/Dropdown.tsx index 6207c6ebab..d6b46d5da1 100644 --- a/packages/screens/DAppStore/components/Dropdown.tsx +++ b/packages/screens/DAppStore/components/Dropdown.tsx @@ -2,11 +2,11 @@ import React, { useEffect, useState } from "react"; import { StyleProp, TouchableOpacity, View, ViewStyle } from "react-native"; import { useSelector } from "react-redux"; -import { CheckboxDappStore } from "./CheckboxDappStore"; import chevronDownSVG from "../../../../assets/icons/chevron-down.svg"; import chevronUpSVG from "../../../../assets/icons/chevron-up.svg"; import { BrandText } from "@/components/BrandText"; +import { Checkbox } from "@/components/Checkbox"; import { SVG } from "@/components/SVG"; import { SecondaryBox } from "@/components/boxes/SecondaryBox"; import { useDropdowns } from "@/hooks/useDropdowns"; @@ -47,7 +47,7 @@ const SelectableOption: React.FC<{ onPress={handleClick} style={[{ flexDirection: "row", alignItems: "center" }, style]} > - + {name} diff --git a/packages/screens/Message/components/CheckboxGroup.tsx b/packages/screens/Message/components/CheckboxGroup.tsx index 289d1fd1f0..efa1d5850b 100644 --- a/packages/screens/Message/components/CheckboxGroup.tsx +++ b/packages/screens/Message/components/CheckboxGroup.tsx @@ -3,38 +3,38 @@ import { TouchableOpacity, View } from "react-native"; import { Avatar } from "react-native-paper"; import FlexRow from "../../../components/FlexRow"; -import { CheckboxDappStore } from "../../DAppStore/components/CheckboxDappStore"; import { BrandText } from "@/components/BrandText"; +import { Checkbox } from "@/components/Checkbox"; import { SpacerColumn, SpacerRow } from "@/components/spacer"; import { neutral77, secondaryColor } from "@/utils/style/colors"; import { fontSemibold14 } from "@/utils/style/fonts"; import { layout } from "@/utils/style/layout"; -export interface CheckboxItem { +export interface CheckboxMessageItem { id: string; name: string; avatar: string; checked: boolean; } -interface CheckboxGroupProps { - items: CheckboxItem[]; - onChange: (items: CheckboxItem[]) => void; +interface CheckboxMessageGroupProps { + items: CheckboxMessageItem[]; + onChange: (items: CheckboxMessageItem[]) => void; searchText: string; } -const Checkbox = ({ +const CheckboxMessage = ({ item, onPress, }: { - item: CheckboxItem; + item: CheckboxMessageItem; onPress: () => void; }) => { return ( <> - + @@ -49,12 +49,13 @@ const Checkbox = ({ ); }; -export const CheckboxGroup: React.FC = ({ +export const CheckboxGroup: React.FC = ({ items, onChange, searchText, }) => { - const [checkboxItems, setCheckboxItems] = useState(items); + const [checkboxItems, setCheckboxItems] = + useState(items); const handleCheckboxPress = (id: string) => { const newItems = checkboxItems; const itemIndex = newItems.findIndex((item) => item.id === id); @@ -86,7 +87,7 @@ export const CheckboxGroup: React.FC = ({ )} {!searchText.length && checkboxItems.map((item, index) => ( - handleCheckboxPress(item.id)} @@ -94,7 +95,7 @@ export const CheckboxGroup: React.FC = ({ ))} {!!searchText.length && searchItems.map((item, index) => ( - handleCheckboxPress(item.id)} diff --git a/packages/screens/Message/components/CreateGroup.tsx b/packages/screens/Message/components/CreateGroup.tsx index 021bf1252e..ad54ba7baa 100644 --- a/packages/screens/Message/components/CreateGroup.tsx +++ b/packages/screens/Message/components/CreateGroup.tsx @@ -2,7 +2,7 @@ import React, { useMemo, useState } from "react"; import { ScrollView, View } from "react-native"; import { useSelector } from "react-redux"; -import { CheckboxGroup, CheckboxItem } from "./CheckboxGroup"; +import { CheckboxGroup, CheckboxMessageItem } from "./CheckboxGroup"; import ModalBase from "../../../components/modals/ModalBase"; import { GroupInfo_Reply } from "@/api/weshnet/protocoltypes"; @@ -40,13 +40,13 @@ export const CreateGroup = ({ onClose }: CreateGroupProps) => { const [searchText, setSearchText] = useState(""); const conversations = useSelector(selectConversationList); - const handleChange = (items: CheckboxItem[]) => { + const handleChange = (items: CheckboxMessageItem[]) => { setCheckedContacts( items.filter((item) => !item.checked).map((item) => item.id), ); }; - const items: CheckboxItem[] = useMemo(() => { + const items: CheckboxMessageItem[] = useMemo(() => { return conversations .filter((conv) => conv.type === "contact") .map((item) => { diff --git a/packages/screens/Organizations/components/MembershipOrg/MembershipDeployerSteps.tsx b/packages/screens/Organizations/components/MembershipOrg/MembershipDeployerSteps.tsx index 92ae29cedd..1a4b680cef 100644 --- a/packages/screens/Organizations/components/MembershipOrg/MembershipDeployerSteps.tsx +++ b/packages/screens/Organizations/components/MembershipOrg/MembershipDeployerSteps.tsx @@ -60,6 +60,7 @@ export const MembershipDeployerSteps: React.FC<{ const pkgPath = await adenaDeployGnoDAO( network.id, selectedWallet?.address!, + organizationData?.structure!, { name, maxVotingPeriodSeconds: diff --git a/packages/screens/Organizations/components/RolesOrg/RolesDeployerSteps.tsx b/packages/screens/Organizations/components/RolesOrg/RolesDeployerSteps.tsx index 20ad91e8f3..bd6b04d754 100644 --- a/packages/screens/Organizations/components/RolesOrg/RolesDeployerSteps.tsx +++ b/packages/screens/Organizations/components/RolesOrg/RolesDeployerSteps.tsx @@ -62,7 +62,11 @@ export const RolesDeployerSteps: React.FC<{ case NetworkKind.Gno: { const name = organizationData?.associatedHandle!; const roles = - rolesSettingsFormData?.roles?.map((role) => role.name.trim()) || []; + rolesSettingsFormData?.roles?.map((role) => ({ + name: role.name.trim(), + color: role.color, + resources: role.resources, + })) || []; const initialMembers = (memberSettingsFormData?.members || []).map( (member) => ({ address: member.addr, @@ -75,6 +79,7 @@ export const RolesDeployerSteps: React.FC<{ const pkgPath = await adenaDeployGnoDAO( network.id, selectedWallet?.address!, + organizationData?.structure!, { name, maxVotingPeriodSeconds: diff --git a/packages/screens/Organizations/components/RolesOrg/RolesModalCreateRole.tsx b/packages/screens/Organizations/components/RolesOrg/RolesModalCreateRole.tsx new file mode 100644 index 0000000000..1e5a57cfdf --- /dev/null +++ b/packages/screens/Organizations/components/RolesOrg/RolesModalCreateRole.tsx @@ -0,0 +1,98 @@ +import { Control } from "react-hook-form"; +import { ScrollView, TouchableOpacity, View } from "react-native"; + +import { BrandText } from "@/components/BrandText"; +import { Checkbox } from "@/components/Checkbox"; +import { Box } from "@/components/boxes/Box"; +import { PrimaryButton } from "@/components/buttons/PrimaryButton"; +import { Label, TextInputCustom } from "@/components/inputs/TextInputCustom"; +import ModalBase from "@/components/modals/ModalBase"; +import { SpacerColumn, SpacerRow } from "@/components/spacer"; +import { neutral33 } from "@/utils/style/colors"; +import { fontSemibold18 } from "@/utils/style/fonts"; +import { layout } from "@/utils/style/layout"; +import { RolesSettingFormType } from "@/utils/types/organizations"; + +interface RolesModalCreateRoleProps { + modalVisible: boolean; + rolesIndexes: number[]; + resources: { name: string; resources: string[]; value: boolean }[]; + control: Control; + onCloseModal: () => void; + onCheckboxChange: (index: number) => void; + addRoleField: () => void; +} + +export const RolesModalCreateRole: React.FC = ({ + modalVisible, + rolesIndexes, + resources, + control, + onCloseModal, + onCheckboxChange, + addRoleField, +}) => { + return ( + + + + control={control} + noBrokenCorners + name={`roles.${rolesIndexes.length}.name`} + label="Role name" + placeholder="Role name" + rules={{ required: true }} + placeHolder="Role name" + /> + + + control={control} + noBrokenCorners + name={`roles.${rolesIndexes.length}.color`} + label="Role color" + placeholder="Role color" + placeHolder="Role color" + /> + + + + + + + {/* TODO: Refactor Checkbox to make it a global component instead of Dapp!*/} + {resources.map((resource, index) => ( + + onCheckboxChange(index)}> + + + + {resource.name} + + + ))} + + + + + + + + + + ); +}; diff --git a/packages/screens/Organizations/components/RolesOrg/RolesReviewInformationSection.tsx b/packages/screens/Organizations/components/RolesOrg/RolesReviewInformationSection.tsx index cdaccfc245..00a4a26e11 100644 --- a/packages/screens/Organizations/components/RolesOrg/RolesReviewInformationSection.tsx +++ b/packages/screens/Organizations/components/RolesOrg/RolesReviewInformationSection.tsx @@ -169,7 +169,9 @@ export const RolesReviewInformationSection: React.FC< ( - {role.name} + + {role.name} features: {role.resources?.join(", ")} + )} /> {rolesSettingData?.roles.length !== index + 1 && ( diff --git a/packages/screens/Organizations/components/RolesOrg/RolesSettingsSection.tsx b/packages/screens/Organizations/components/RolesOrg/RolesSettingsSection.tsx index 74bdbeb867..5ae90bd494 100644 --- a/packages/screens/Organizations/components/RolesOrg/RolesSettingsSection.tsx +++ b/packages/screens/Organizations/components/RolesOrg/RolesSettingsSection.tsx @@ -1,19 +1,25 @@ import { useState } from "react"; import { useForm } from "react-hook-form"; import { Pressable, View } from "react-native"; -import { ScrollView } from "react-native-gesture-handler"; +import { FlatList, ScrollView } from "react-native-gesture-handler"; +import { RolesModalCreateRole } from "./RolesModalCreateRole"; import trashSVG from "../../../../../assets/icons/trash.svg"; import { BrandText } from "@/components/BrandText"; import { SVG } from "@/components/SVG"; import { PrimaryButton } from "@/components/buttons/PrimaryButton"; import { SecondaryButton } from "@/components/buttons/SecondaryButton"; -import { TextInputCustom } from "@/components/inputs/TextInputCustom"; -import { SpacerColumn, SpacerRow } from "@/components/spacer"; +import { SpacerColumn } from "@/components/spacer"; +import { TableCell } from "@/components/table/TableCell"; +import { TableHeader } from "@/components/table/TableHeader"; +import { TableRow } from "@/components/table/TableRow"; +import { TableTextCell } from "@/components/table/TableTextCell"; +import { TableWrapper } from "@/components/table/TableWrapper"; +import { TableColumns } from "@/components/table/utils"; import { neutral33 } from "@/utils/style/colors"; import { fontSemibold28 } from "@/utils/style/fonts"; -import { layout } from "@/utils/style/layout"; +import { layout, screenContentMaxWidthLarge } from "@/utils/style/layout"; import { ROLES_BASED_ORGANIZATION_STEPS, RolesSettingFormType, @@ -26,25 +32,76 @@ interface RolesSettingsSectionProps { export const RolesSettingsSection: React.FC = ({ onSubmit, }) => { - const { handleSubmit, control, unregister } = useForm(); - + const { + handleSubmit, + control, + unregister, + register, + setValue, + resetField, + getValues, + } = useForm(); + const [modalVisible, setModalVisible] = useState(false); const [rolesIndexes, setRolesIndexes] = useState([]); + const [resources, setResources] = + useState<{ name: string; resources: string[]; value: boolean }[]>( + fakeResources, + ); const removeRoleField = (id: number, index: number) => { unregister(`roles.${index}.name`); unregister(`roles.${index}.color`); + unregister(`roles.${index}.resources`); if (rolesIndexes.length > 0) { const copyIndex = [...rolesIndexes].filter((i) => i !== id); setRolesIndexes(copyIndex); } }; + const resetModal = () => { + resetField(`roles.${rolesIndexes.length}.name`); + resetField(`roles.${rolesIndexes.length}.color`); + resetField(`roles.${rolesIndexes.length}.resources`); + }; + + const onOpenModal = () => { + resetModal(); + setResources(fakeResources.map((r) => ({ ...r, value: false }))); + setModalVisible(true); + }; + const addRoleField = () => { + register(`roles.${rolesIndexes.length}.resources`); + const selectedResources = resources + .filter((r) => r.value) + .flatMap((r) => r.resources); + setValue(`roles.${rolesIndexes.length}.resources`, selectedResources); + console.log(`Selected resources: ${selectedResources}`); setRolesIndexes([...rolesIndexes, Math.floor(Math.random() * 200000)]); + setModalVisible(false); + }; + + const onCloseModal = () => { + setModalVisible(false); + }; + + const onCheckboxChange = (index: number) => { + const copyResources = [...resources]; + copyResources[index].value = !copyResources[index].value; + setResources(copyResources); }; return ( + = ({ Roles - {rolesIndexes.map((id, index) => ( - - - - control={control} - noBrokenCorners - name={`roles.${index}.name`} - label="Role name" - placeholder="Role name" - rules={{ required: true }} - placeHolder="Role name" - /> - - - - - control={control} - noBrokenCorners - name={`roles.${index}.color`} - label="Role color" - placeholder="Role color" - placeHolder="Role color" - /> - - - - { - removeRoleField(id, index); - }} - > - - - - - ))} - + + Roles table + + + + { + const role = getValues(`roles.${index}`); + + if (!role) { + return null; + } + + return ( + + + + + ); + }} + keyExtractor={(item) => item.toString()} + /> + + + + = ({ ); }; + +const RoleTableRow: React.FC<{ + role: { name: string; color: string; resources: string[] | undefined }; + removeRoleField: (id: number, index: number) => void; + id: number; + index: number; +}> = ({ role, removeRoleField, id, index }) => { + return ( + + + {role.name} + + + {role.color} + + + {role.resources?.join(", ") || "No resources defined"} + + + + { + removeRoleField(id, index); + }} + > + + + + + + ); +}; + +const columns: TableColumns = { + name: { + label: "Name", + flex: 1, + minWidth: 120, + }, + color: { + label: "Color", + flex: 1, + minWidth: 60, + }, + resources: { + label: "Resources", + flex: 1.5, + minWidth: 150, + }, + delete: { + label: "Delete", + flex: 0.25, + minWidth: 30, + }, +}; + +// TODO: Create a hook to get all the resources +const fakeResources = [ + { + name: "Organizations", + resources: [], + value: false, + }, + { + name: "Social Feed", + resources: ["gno.land/r/teritori/social_feeds.CreatePost"], + value: false, + }, + { + name: "Marketplace", + resources: [], + value: false, + }, + { + name: "Launchpad NFT", + resources: [], + value: false, + }, + { + name: "Launchpad ERC20", + resources: [], + value: false, + }, + { + name: "Name Service", + resources: [], + value: false, + }, + { + name: "Multisig Wallet", + resources: [], + value: false, + }, + { + name: "Projects", + resources: [], + value: false, + }, +]; diff --git a/packages/screens/Organizations/components/TokenOrg/TokenDeployerSteps.tsx b/packages/screens/Organizations/components/TokenOrg/TokenDeployerSteps.tsx index 873cc77500..2d16fcd59f 100644 --- a/packages/screens/Organizations/components/TokenOrg/TokenDeployerSteps.tsx +++ b/packages/screens/Organizations/components/TokenOrg/TokenDeployerSteps.tsx @@ -23,6 +23,7 @@ import { getDuration, getPercent } from "@/utils/gnodao/helpers"; import { ConfigureVotingFormType, CreateDaoFormType, + DaoType, LAUNCHING_PROCESS_STEPS, TOKEN_ORGANIZATION_DEPLOYER_STEPS, TokenSettingFormType, @@ -61,6 +62,7 @@ export const TokenDeployerSteps: React.FC<{ const pkgPath = await adenaDeployGnoDAO( network.id, selectedWallet?.address!, + DaoType.TOKEN_BASED, { name, maxVotingPeriodSeconds: diff --git a/packages/utils/gnodao/deploy.ts b/packages/utils/gnodao/deploy.ts index 59c255e911..347c45bc24 100644 --- a/packages/utils/gnodao/deploy.ts +++ b/packages/utils/gnodao/deploy.ts @@ -1,5 +1,7 @@ -import { mustGetGnoNetwork } from "../../networks"; +import { generateMembershipDAOSource } from "./generateMembershipDAOSource"; +import { generateRolesDAOSource } from "./generateRolesDAOSource"; import { adenaAddPkg } from "../gno"; +import { DaoType } from "../types/organizations"; interface GnoDAOMember { address: string; @@ -7,10 +9,16 @@ interface GnoDAOMember { roles: string[]; } -interface GnoDAOConfig { +interface GnoDAORole { + name: string; + color: string; + resources: string[] | undefined; +} + +export interface GnoDAOConfig { name: string; maxVotingPeriodSeconds: number; - roles: string[] | undefined; + roles: GnoDAORole[] | undefined; initialMembers: GnoDAOMember[]; thresholdPercent: number; quorumPercent: number; @@ -19,149 +27,18 @@ interface GnoDAOConfig { imageURI: string; } -const generateDAORealmSource = (networkId: string, conf: GnoDAOConfig) => { - const network = mustGetGnoNetwork(networkId); - return `package ${conf.name} - - import ( - "time" - - dao_core "${network.daoCorePkgPath}" - dao_interfaces "${network.daoInterfacesPkgPath}" - proposal_single "${network.daoProposalSinglePkgPath}" - "${network.rolesGroupPkgPath}" - "${network.daoUtilsPkgPath}" - "${network.profilePkgPath}" - voting_group "${network.votingGroupPkgPath}" - "${network.daoRegistryPkgPath}" - "${network.socialFeedsPkgPath}" - ) - -var ( - daoCore dao_interfaces.IDAOCore - group *voting_group.VotingGroup - roles *dao_roles_group.RolesGroup - registered bool -) - -func init() { - votingModuleFactory := func(core dao_interfaces.IDAOCore) dao_interfaces.IVotingModule { - group = voting_group.NewVotingGroup() - ${conf.initialMembers - .map( - (member) => - `group.SetMemberPower("${member.address}", ${member.weight})`, - ) - .join("\n\t")} - return group - } - - rolesModuleFactory := func(core dao_interfaces.IDAOCore) dao_interfaces.IRolesModule { - roles = dao_roles_group.NewRolesGroup() - ${(conf.roles ?? []).map((role) => `roles.NewRole("${role}");`).join("\n\t")} - ${conf.initialMembers.map((member) => member.roles.map((role) => `roles.GrantRole("${member.address}", "${role}")`).join("\n\t"))} - return roles - } - - - // TODO: consider using factories that return multiple modules and handlers - - proposalModulesFactories := []dao_interfaces.ProposalModuleFactory{ - func(core dao_interfaces.IDAOCore) dao_interfaces.IProposalModule { - tt := proposal_single.PercentageThresholdPercent(${Math.ceil( - conf.thresholdPercent * 100, - )}) // ${Math.ceil(conf.thresholdPercent * 100) / 100}% - tq := proposal_single.PercentageThresholdPercent(${Math.ceil( - conf.quorumPercent * 100, - )}) // ${Math.ceil(conf.quorumPercent * 100) / 100}% - return proposal_single.NewDAOProposalSingle(core, &proposal_single.DAOProposalSingleOpts{ - MaxVotingPeriod: dao_utils.DurationTime(time.Second * ${conf.maxVotingPeriodSeconds}), - Threshold: &proposal_single.ThresholdThresholdQuorum{ - Threshold: &tt, - Quorum: &tq, - }, - }) - }, - } - - messageHandlersFactories := []dao_interfaces.MessageHandlerFactory{ - func(core dao_interfaces.IDAOCore) dao_interfaces.MessageHandler { - return group.UpdateMembersHandler() - }, - func(core dao_interfaces.IDAOCore) dao_interfaces.MessageHandler { - // TODO: add a router to support multiple proposal modules - propMod := core.ProposalModules()[0] - return proposal_single.NewUpdateSettingsHandler(propMod.Module.(*proposal_single.DAOProposalSingle)) - }, - func(core dao_interfaces.IDAOCore) dao_interfaces.MessageHandler { - return social_feeds.NewCreatePostHandler() - }, - } - - daoCore = dao_core.NewDAOCore(votingModuleFactory, rolesModuleFactory, proposalModulesFactories, messageHandlersFactories) - - // Register the DAO profile - profile.SetStringField(profile.DisplayName, "${conf.displayName}") - profile.SetStringField(profile.Bio, "${conf.description}") - profile.SetStringField(profile.Avatar, "${conf.imageURI}") - - dao_registry.Register(func() dao_interfaces.IDAOCore { return daoCore }, "${conf.displayName}", "${conf.description}", "${conf.imageURI}") - } - - func Render(path string) string { - return daoCore.Render(path) - } - - func VoteJSON(moduleIndex int, proposalID int, voteJSON string) { - // move check in dao core - module := dao_core.GetProposalModule(daoCore, moduleIndex) - if !module.Enabled { - panic("proposal module is not enabled") - } - - module.Module.VoteJSON(proposalID, voteJSON) - } - - func Execute(moduleIndex int, proposalID int) { - // move check in dao core - module := dao_core.GetProposalModule(daoCore, moduleIndex) - if !module.Enabled { - panic("proposal module is not enabled") - } - - module.Module.Execute(proposalID) - } - - func ProposeJSON(moduleIndex int, proposalJSON string) int { - // move check in dao core - module := dao_core.GetProposalModule(daoCore, moduleIndex) - if !module.Enabled { - panic("proposal module is not enabled") - } - - return module.Module.ProposeJSON(proposalJSON) - } - - func getProposalsJSON(moduleIndex int, limit int, startAfter string, reverse bool) string { - // move logic in dao core - module := dao_core.GetProposalModule(daoCore, moduleIndex) - return module.Module.ProposalsJSON(limit, startAfter, reverse) - } - - func getProposalJSON(moduleIndex int, proposalIndex int) string { - // move logic in dao core - module := dao_core.GetProposalModule(daoCore, moduleIndex) - return module.Module.ProposalJSON(proposalIndex) - } -`; -}; - export const adenaDeployGnoDAO = async ( networkId: string, creator: string, + structure: DaoType, conf: GnoDAOConfig, ) => { - const source = generateDAORealmSource(networkId, conf); + let source = ""; + if (structure === DaoType.MEMBER_BASED) { + source = generateMembershipDAOSource(networkId, conf); + } else { + source = generateRolesDAOSource(networkId, conf); + } const pkgPath = `gno.land/r/${creator}/${conf.name}`; await adenaAddPkg( networkId, diff --git a/packages/utils/gnodao/generateMembershipDAOSource.ts b/packages/utils/gnodao/generateMembershipDAOSource.ts new file mode 100644 index 0000000000..8e0fe7542c --- /dev/null +++ b/packages/utils/gnodao/generateMembershipDAOSource.ts @@ -0,0 +1,143 @@ +import { GnoDAOConfig } from "./deploy"; +import { mustGetGnoNetwork } from "../../networks"; + +// TODO: Allow the role modules to be optional and don't use in MembershipDAO +export const generateMembershipDAOSource = ( + networkId: string, + conf: GnoDAOConfig, +) => { + const network = mustGetGnoNetwork(networkId); + return `package ${conf.name} + + import ( + "time" + + dao_core "${network.daoCorePkgPath}" + dao_interfaces "${network.daoInterfacesPkgPath}" + proposal_single "${network.daoProposalSinglePkgPath}" + "${network.rolesGroupPkgPath}" + "${network.daoUtilsPkgPath}" + "${network.profilePkgPath}" + voting_group "${network.votingGroupPkgPath}" + "${network.daoRegistryPkgPath}" + "${network.socialFeedsPkgPath}" + ) + +var ( + daoCore dao_interfaces.IDAOCore + group *voting_group.VotingGroup + roles *dao_roles_group.RolesGroup + registered bool +) + +func init() { + votingModuleFactory := func(core dao_interfaces.IDAOCore) dao_interfaces.IVotingModule { + group = voting_group.NewVotingGroup() + ${conf.initialMembers + .map( + (member) => + `group.SetMemberPower("${member.address}", ${member.weight})`, + ) + .join("\n\t")} + return group + } + + rolesModuleFactory := func(core dao_interfaces.IDAOCore) dao_interfaces.IRolesModule { + roles = dao_roles_group.NewRolesGroup() + ${(conf.roles ?? []).map((role) => `roles.NewRole("${role}", "");`).join("\n\t")} + ${conf.initialMembers.map((member) => member.roles.map((role) => `roles.GrantRole("${member.address}", "${role}")`).join("\n\t"))} + return roles + } + + + // TODO: consider using factories that return multiple modules and handlers + + proposalModulesFactories := []dao_interfaces.ProposalModuleFactory{ + func(core dao_interfaces.IDAOCore) dao_interfaces.IProposalModule { + tt := proposal_single.PercentageThresholdPercent(${Math.ceil( + conf.thresholdPercent * 100, + )}) // ${Math.ceil(conf.thresholdPercent * 100) / 100}% + tq := proposal_single.PercentageThresholdPercent(${Math.ceil( + conf.quorumPercent * 100, + )}) // ${Math.ceil(conf.quorumPercent * 100) / 100}% + return proposal_single.NewDAOProposalSingle(core, &proposal_single.DAOProposalSingleOpts{ + MaxVotingPeriod: dao_utils.DurationTime(time.Second * ${conf.maxVotingPeriodSeconds}), + Threshold: &proposal_single.ThresholdThresholdQuorum{ + Threshold: &tt, + Quorum: &tq, + }, + }) + }, + } + + messageHandlersFactories := []dao_interfaces.MessageHandlerFactory{ + func(core dao_interfaces.IDAOCore) dao_interfaces.MessageHandler { + return group.UpdateMembersHandler() + }, + func(core dao_interfaces.IDAOCore) dao_interfaces.MessageHandler { + // TODO: add a router to support multiple proposal modules + propMod := core.ProposalModules()[0] + return proposal_single.NewUpdateSettingsHandler(propMod.Module.(*proposal_single.DAOProposalSingle)) + }, + func(core dao_interfaces.IDAOCore) dao_interfaces.MessageHandler { + return social_feeds.NewCreatePostHandler() + }, + } + + daoCore = dao_core.NewDAOCore(votingModuleFactory, rolesModuleFactory, proposalModulesFactories, messageHandlersFactories) + + // Register the DAO profile + profile.SetStringField(profile.DisplayName, "${conf.displayName}") + profile.SetStringField(profile.Bio, "${conf.description}") + profile.SetStringField(profile.Avatar, "${conf.imageURI}") + + dao_registry.Register(func() dao_interfaces.IDAOCore { return daoCore }, "${conf.displayName}", "${conf.description}", "${conf.imageURI}") + } + + func Render(path string) string { + return daoCore.Render(path) + } + + func VoteJSON(moduleIndex int, proposalID int, voteJSON string) { + // move check in dao core + module := dao_core.GetProposalModule(daoCore, moduleIndex) + if !module.Enabled { + panic("proposal module is not enabled") + } + + module.Module.VoteJSON(proposalID, voteJSON) + } + + func Execute(moduleIndex int, proposalID int) { + // move check in dao core + module := dao_core.GetProposalModule(daoCore, moduleIndex) + if !module.Enabled { + panic("proposal module is not enabled") + } + + module.Module.Execute(proposalID) + } + + func ProposeJSON(moduleIndex int, proposalJSON string) int { + // move check in dao core + module := dao_core.GetProposalModule(daoCore, moduleIndex) + if !module.Enabled { + panic("proposal module is not enabled") + } + + return module.Module.ProposeJSON(proposalJSON) + } + + func getProposalsJSON(moduleIndex int, limit int, startAfter string, reverse bool) string { + // move logic in dao core + module := dao_core.GetProposalModule(daoCore, moduleIndex) + return module.Module.ProposalsJSON(limit, startAfter, reverse) + } + + func getProposalJSON(moduleIndex int, proposalIndex int) string { + // move logic in dao core + module := dao_core.GetProposalModule(daoCore, moduleIndex) + return module.Module.ProposalJSON(proposalIndex) + } +`; +}; diff --git a/packages/utils/gnodao/generateRolesDAOSource.ts b/packages/utils/gnodao/generateRolesDAOSource.ts new file mode 100644 index 0000000000..93d30f392a --- /dev/null +++ b/packages/utils/gnodao/generateRolesDAOSource.ts @@ -0,0 +1,159 @@ +import { GnoDAOConfig } from "./deploy"; +import { mustGetGnoNetwork } from "../../networks"; + +export const generateRolesDAOSource = ( + networkId: string, + conf: GnoDAOConfig, +) => { + const network = mustGetGnoNetwork(networkId); + return `package ${conf.name} + + import ( + "time" + + dao_core "${network.daoCorePkgPath}" + dao_interfaces "${network.daoInterfacesPkgPath}" + proposal_single "${network.daoProposalSinglePkgPath}" + "${network.rolesGroupPkgPath}" + "${network.daoUtilsPkgPath}" + "${network.profilePkgPath}" + voting_group "${network.rolesVotingGroupPkgPath}" + "${network.daoRegistryPkgPath}" + "${network.socialFeedsPkgPath}" + ) + +var ( + daoCore dao_interfaces.IDAOCore + group *voting_group.RolesVotingGroup + roles *dao_roles_group.RolesGroup + registered bool +) + +func init() { + rolesModuleFactory := func(core dao_interfaces.IDAOCore) dao_interfaces.IRolesModule { + roles = dao_roles_group.NewRolesGroup() + ${(conf.roles ?? []) + .map( + (role) => + `roles.NewRoleJSON("${role.name}", "[${(role.resources ?? []) + .map( + (resource) => + `{\\"resource\\": \\"${resource}\\", \\"power\\": \\"999\\"}`, + ) + .join(", ")}]")`, + ) + .join("\n\t")} + ${conf.initialMembers + .filter((member) => member.roles.length > 0) + .map((member) => + member.roles + .map((role) => `roles.GrantRole("${member.address}", "${role}")`) + .join("\n\t"), + ) + .join("\n\t")} + return roles + } + + votingModuleFactory := func(core dao_interfaces.IDAOCore) dao_interfaces.IVotingModule { + group = voting_group.NewRolesVotingGroup(core.RolesModule()) + ${conf.initialMembers + .map( + (member) => + `group.SetMemberPower("${member.address}", ${member.weight})`, + ) + .join("\n\t")} + return group + } + + + // TODO: consider using factories that return multiple modules and handlers + + proposalModulesFactories := []dao_interfaces.ProposalModuleFactory{ + func(core dao_interfaces.IDAOCore) dao_interfaces.IProposalModule { + tt := proposal_single.PercentageThresholdPercent(${Math.ceil( + conf.thresholdPercent * 100, + )}) // ${Math.ceil(conf.thresholdPercent * 100) / 100}% + tq := proposal_single.PercentageThresholdPercent(${Math.ceil( + conf.quorumPercent * 100, + )}) // ${Math.ceil(conf.quorumPercent * 100) / 100}% + return proposal_single.NewDAOProposalSingle(core, &proposal_single.DAOProposalSingleOpts{ + MaxVotingPeriod: dao_utils.DurationTime(time.Second * ${conf.maxVotingPeriodSeconds}), + Threshold: &proposal_single.ThresholdThresholdQuorum{ + Threshold: &tt, + Quorum: &tq, + }, + }) + }, + } + + messageHandlersFactories := []dao_interfaces.MessageHandlerFactory{ + func(core dao_interfaces.IDAOCore) dao_interfaces.MessageHandler { + return group.UpdateMembersHandler() + }, + func(core dao_interfaces.IDAOCore) dao_interfaces.MessageHandler { + // TODO: add a router to support multiple proposal modules + propMod := core.ProposalModules()[0] + return proposal_single.NewUpdateSettingsHandler(propMod.Module.(*proposal_single.DAOProposalSingle)) + }, + func(core dao_interfaces.IDAOCore) dao_interfaces.MessageHandler { + return social_feeds.NewCreatePostHandler() + }, + } + + daoCore = dao_core.NewDAOCore(votingModuleFactory, rolesModuleFactory, proposalModulesFactories, messageHandlersFactories) + + // Register the DAO profile + profile.SetStringField(profile.DisplayName, "${conf.displayName}") + profile.SetStringField(profile.Bio, "${conf.description}") + profile.SetStringField(profile.Avatar, "${conf.imageURI}") + + dao_registry.Register(func() dao_interfaces.IDAOCore { return daoCore }, "${conf.displayName}", "${conf.description}", "${conf.imageURI}") + } + + func Render(path string) string { + return daoCore.Render(path) + } + + func VoteJSON(moduleIndex int, proposalID int, voteJSON string) { + // move check in dao core + module := dao_core.GetProposalModule(daoCore, moduleIndex) + if !module.Enabled { + panic("proposal module is not enabled") + } + + module.Module.VoteJSON(proposalID, voteJSON) + } + + func Execute(moduleIndex int, proposalID int) { + // move check in dao core + module := dao_core.GetProposalModule(daoCore, moduleIndex) + if !module.Enabled { + panic("proposal module is not enabled") + } + + module.Module.Execute(proposalID) + } + + func ProposeJSON(moduleIndex int, proposalJSON string) int { + // move check in dao core + module := dao_core.GetProposalModule(daoCore, moduleIndex) + if !module.Enabled { + panic("proposal module is not enabled") + } + + return module.Module.ProposeJSON(proposalJSON) + } + + func getProposalsJSON(moduleIndex int, limit int, startAfter string, reverse bool) string { + // move logic in dao core + module := dao_core.GetProposalModule(daoCore, moduleIndex) + return module.Module.ProposalsJSON(limit, startAfter, reverse) + } + + func getProposalJSON(moduleIndex int, proposalIndex int) string { + // move logic in dao core + module := dao_core.GetProposalModule(daoCore, moduleIndex) + return module.Module.ProposalJSON(proposalIndex) + } +`; +}; diff --git a/packages/utils/types/organizations.ts b/packages/utils/types/organizations.ts index 66673bdeaa..eb1cf9457c 100644 --- a/packages/utils/types/organizations.ts +++ b/packages/utils/types/organizations.ts @@ -42,7 +42,7 @@ export type MembershipMemberSettingFormType = { // ROLES BASED ORGANIZATION FORM TYPES export type RolesSettingFormType = { - roles: { name: string; color: string }[]; + roles: { name: string; color: string; resources: string[] | undefined }[]; }; export type RolesMemberSettingFormType = { From 7f31f696377a61261cc27fded50d926770d36fc0 Mon Sep 17 00:00:00 2001 From: n0izn0iz Date: Mon, 23 Dec 2024 17:46:01 +0100 Subject: [PATCH 10/20] feat: leaner dao interfaces (#1465) Signed-off-by: Norman Meier Co-authored-by: MikaelVallenet --- gno/p/dao_core/dao_core.gno | 47 +-------- gno/p/dao_core/dao_core_test.gno | 62 +----------- gno/p/dao_interfaces/core.gno | 3 - gno/p/dao_interfaces/core_testing.gno | 10 +- gno/p/dao_interfaces/modules.gno | 16 ---- .../dao_proposal_single.gno | 8 +- gno/p/dao_roles_group/roles_group.gno | 2 - .../roles_voting_group.gno | 9 +- .../roles_voting_group_test.gno | 2 +- gno/p/havl/havl.gno | 2 +- gno/r/dao_realm/dao_realm.gno | 11 +-- gno/r/dao_roles_realm.gno/dao_roles_realm.gno | 47 ++++++--- networks.json | 2 +- packages/hooks/dao/useDAOMembers.ts | 6 +- packages/networks/gno-portal/index.ts | 2 +- packages/scripts/generateDAOSource.ts | 60 ++++++++++++ .../gnodao/generateMembershipDAOSource.ts | 95 +++++++++---------- .../utils/gnodao/generateRolesDAOSource.ts | 73 +++++++++----- 18 files changed, 211 insertions(+), 246 deletions(-) create mode 100644 packages/scripts/generateDAOSource.ts diff --git a/gno/p/dao_core/dao_core.gno b/gno/p/dao_core/dao_core.gno index 86f9d7126d..74791b8b7f 100644 --- a/gno/p/dao_core/dao_core.gno +++ b/gno/p/dao_core/dao_core.gno @@ -5,9 +5,7 @@ import ( "strconv" "strings" - "gno.land/p/demo/json" dao_interfaces "gno.land/p/teritori/dao_interfaces" - "gno.land/p/teritori/jsonutil" ) // TODO: add wrapper message handler to handle multiple proposal modules messages @@ -16,7 +14,6 @@ type daoCore struct { dao_interfaces.IDAOCore votingModule dao_interfaces.IVotingModule - rolesModule dao_interfaces.IRolesModule proposalModules []dao_interfaces.ActivableProposalModule activeProposalModuleCount int realm std.Realm @@ -25,7 +22,6 @@ type daoCore struct { func NewDAOCore( votingModuleFactory dao_interfaces.VotingModuleFactory, - rolesModuleFactory dao_interfaces.RolesModuleFactory, proposalModulesFactories []dao_interfaces.ProposalModuleFactory, messageHandlersFactories []dao_interfaces.MessageHandlerFactory, ) dao_interfaces.IDAOCore { @@ -33,10 +29,6 @@ func NewDAOCore( panic("Missing voting module factory") } - if rolesModuleFactory == nil { - panic("Missing roles module factory") - } - if len(proposalModulesFactories) == 0 { panic("No proposal modules factories") } @@ -48,12 +40,6 @@ func NewDAOCore( proposalModules: make([]dao_interfaces.ActivableProposalModule, len(proposalModulesFactories)), } - // important to keep this order since voting module might depend on roles module - core.rolesModule = rolesModuleFactory(core) - if core.rolesModule == nil { - panic("roles module factory returned nil") - } - core.votingModule = votingModuleFactory(core) if core.votingModule == nil { panic("voting module factory returned nil") @@ -131,32 +117,6 @@ func (d *daoCore) VotingModule() dao_interfaces.IVotingModule { return d.votingModule } -func (d *daoCore) RolesModule() dao_interfaces.IRolesModule { - return d.rolesModule -} - -func (d *daoCore) GetMembersJSON(start, end string, limit uint64, height int64) string { - vMembers := d.votingModule.GetMembersJSON(start, end, limit, height) - nodes, err := json.Unmarshal([]byte(vMembers)) - if err != nil { - panic("failed to unmarshal voting module members") - } - vals := nodes.MustArray() - for i, val := range vals { - obj := val.MustObject() - addr := jsonutil.MustAddress(obj["address"]) - roles := d.rolesModule.GetMemberRoles(addr) - rolesJSON := make([]*json.Node, len(roles)) - for j, role := range roles { - rolesJSON[j] = json.StringNode("", role) - } - obj["roles"] = json.ArrayNode("", rolesJSON) - vals[i] = json.ObjectNode("", obj) - - } - return json.ArrayNode("", vals).String() -} - func (d *daoCore) VotingPowerAtHeight(address std.Address, height int64) uint64 { return d.VotingModule().VotingPowerAtHeight(address, height, []string{}) } @@ -169,15 +129,12 @@ func (d *daoCore) Render(path string) string { sb := strings.Builder{} sb.WriteString("# DAO Core\n") votingInfo := d.votingModule.Info() + sb.WriteString("## Voting Module: ") sb.WriteString(votingInfo.String()) sb.WriteRune('\n') sb.WriteString(d.votingModule.Render("")) - rolesInfo := d.rolesModule.Info() - sb.WriteString("# Roles Module: ") - sb.WriteString(rolesInfo.String()) - sb.WriteRune('\n') - sb.WriteString(d.rolesModule.Render("")) + sb.WriteString("## Supported Messages:\n") sb.WriteString(d.registry.Render()) diff --git a/gno/p/dao_core/dao_core_test.gno b/gno/p/dao_core/dao_core_test.gno index 2c1013d155..d3ab7a8a6f 100644 --- a/gno/p/dao_core/dao_core_test.gno +++ b/gno/p/dao_core/dao_core_test.gno @@ -46,57 +46,6 @@ func (vm *votingModule) TotalPowerAtHeight(height int64) uint64 { return 0 } -type rolesModule struct { - core dao_interfaces.IDAOCore -} - -func rolesModuleFactory(core dao_interfaces.IDAOCore) dao_interfaces.IRolesModule { - return &rolesModule{core: core} -} - -func (rm *rolesModule) Info() dao_interfaces.ModuleInfo { - return dao_interfaces.ModuleInfo{ - Kind: "TestRoles", - Version: "42.21", - } -} - -func (rm *rolesModule) ConfigJSON() string { - return "{}" -} - -func (rm *rolesModule) Render(path string) string { - return "# Test Roles Module" -} - -func (rm *rolesModule) HasRole(address std.Address, role string) bool { - return false -} - -func (rm *rolesModule) NewRoleJSON(roleName, resourcesJSON string) { - panic("not implemented") -} - -func (rm *rolesModule) DeleteRole(roleName string) { - panic("not implemented") -} - -func (rm *rolesModule) GrantRole(address std.Address, role string) { - panic("not implemented") -} - -func (rm *rolesModule) RevokeRole(address std.Address, role string) { - panic("not implemented") -} - -func (rm *rolesModule) GetMemberRoles(address std.Address) []string { - return []string{} -} - -func (rm *rolesModule) GetMemberResourceVPower(address std.Address, resource string) uint64 { - return 0 -} - type proposalModule struct { core dao_interfaces.IDAOCore } @@ -151,7 +100,7 @@ func TestDAOCore(t *testing.T) { return handler } - core := NewDAOCore(votingModuleFactory, rolesModuleFactory, []dao_interfaces.ProposalModuleFactory{proposalModuleFactory}, []dao_interfaces.MessageHandlerFactory{handlerFactory}) + core := NewDAOCore(votingModuleFactory, []dao_interfaces.ProposalModuleFactory{proposalModuleFactory}, []dao_interfaces.MessageHandlerFactory{handlerFactory}) if core == nil { t.Fatal("core is nil") } @@ -169,15 +118,6 @@ func TestDAOCore(t *testing.T) { t.Fatal("voting module has wrong kind") } - rolesMod := core.RolesModule() - if rolesMod == nil { - t.Fatal("roles module is nil") - } - - if rolesMod.Info().Kind != "TestRoles" { - t.Fatal("roles module has wrong kind") - } - propMods := core.ProposalModules() if len(propMods) != 1 { t.Fatal("expected 1 proposal module") diff --git a/gno/p/dao_interfaces/core.gno b/gno/p/dao_interfaces/core.gno index 749a0ccf69..5379638edb 100644 --- a/gno/p/dao_interfaces/core.gno +++ b/gno/p/dao_interfaces/core.gno @@ -11,13 +11,10 @@ type IDAOCore interface { Render(path string) string VotingModule() IVotingModule - RolesModule() IRolesModule ProposalModules() []ActivableProposalModule ActiveProposalModuleCount() int Registry() *MessagesRegistry UpdateVotingModule(newVotingModule IVotingModule) UpdateProposalModules(toAdd []IProposalModule, toDisable []int) - - GetMembersJSON(start, end string, limit uint64, height int64) string } diff --git a/gno/p/dao_interfaces/core_testing.gno b/gno/p/dao_interfaces/core_testing.gno index a61c467bdf..4d0e881750 100644 --- a/gno/p/dao_interfaces/core_testing.gno +++ b/gno/p/dao_interfaces/core_testing.gno @@ -2,6 +2,8 @@ package dao_interfaces type dummyCore struct{} +var _ IDAOCore = (*dummyCore)(nil) + func NewDummyCore() IDAOCore { return &dummyCore{} } @@ -14,10 +16,6 @@ func (d *dummyCore) VotingModule() IVotingModule { panic("not implemented") } -func (d *dummyCore) RolesModule() IRolesModule { - panic("not implemented") -} - func (d *dummyCore) ProposalModules() []ActivableProposalModule { panic("not implemented") } @@ -37,7 +35,3 @@ func (d *dummyCore) UpdateVotingModule(newVotingModule IVotingModule) { func (d *dummyCore) UpdateProposalModules(toAdd []IProposalModule, toDisable []int) { panic("not implemented") } - -func (d *dummyCore) GetMembersJSON(start, end string, limit uint64, height int64) string { - panic("not implemented") -} diff --git a/gno/p/dao_interfaces/modules.gno b/gno/p/dao_interfaces/modules.gno index 5565d9537a..35b375b3ae 100644 --- a/gno/p/dao_interfaces/modules.gno +++ b/gno/p/dao_interfaces/modules.gno @@ -25,7 +25,6 @@ type IVotingModule interface { type VotingModuleFactory func(core IDAOCore) IVotingModule type IProposalModule interface { - Core() IDAOCore Info() ModuleInfo ConfigJSON() string Render(path string) string @@ -37,18 +36,3 @@ type IProposalModule interface { } type ProposalModuleFactory func(core IDAOCore) IProposalModule - -type IRolesModule interface { - Info() ModuleInfo - ConfigJSON() string - Render(path string) string - GetMemberRoles(address std.Address) []string - GetMemberResourceVPower(address std.Address, resource string) uint64 - HasRole(address std.Address, role string) bool - NewRoleJSON(roleName, resourcesJSON string) - DeleteRole(roleName string) - GrantRole(address std.Address, role string) - RevokeRole(address std.Address, role string) -} - -type RolesModuleFactory func(core IDAOCore) IRolesModule diff --git a/gno/p/dao_proposal_single/dao_proposal_single.gno b/gno/p/dao_proposal_single/dao_proposal_single.gno index 19f68130ec..a98024bc0b 100644 --- a/gno/p/dao_proposal_single/dao_proposal_single.gno +++ b/gno/p/dao_proposal_single/dao_proposal_single.gno @@ -56,13 +56,13 @@ func (opts DAOProposalSingleOpts) ToJSON() *json.Node { } type DAOProposalSingle struct { - dao_interfaces.IProposalModule - core dao_interfaces.IDAOCore opts *DAOProposalSingleOpts proposals []*Proposal } +var _ dao_interfaces.IProposalModule = (*DAOProposalSingle)(nil) + func NewDAOProposalSingle(core dao_interfaces.IDAOCore, opts *DAOProposalSingleOpts) *DAOProposalSingle { if core == nil { panic("core cannot be nil") @@ -238,10 +238,6 @@ func (d *DAOProposalSingle) Render(path string) string { return sb.String() } -func (d *DAOProposalSingle) Core() dao_interfaces.IDAOCore { - return d.core -} - func (d *DAOProposalSingle) Info() dao_interfaces.ModuleInfo { return dao_interfaces.ModuleInfo{ Kind: "gno.land/p/teritori/dao_proposal_single", diff --git a/gno/p/dao_roles_group/roles_group.gno b/gno/p/dao_roles_group/roles_group.gno index c7d81ece48..688a2ca12e 100644 --- a/gno/p/dao_roles_group/roles_group.gno +++ b/gno/p/dao_roles_group/roles_group.gno @@ -11,8 +11,6 @@ import ( ) type RolesGroup struct { - dao_interfaces.IRolesModule - rm *role_manager.RoleManager resourcesVPower *avl.Tree // roles -> ResourceVPower[] } diff --git a/gno/p/dao_roles_voting_group/roles_voting_group.gno b/gno/p/dao_roles_voting_group/roles_voting_group.gno index 40f728cb19..07c8d293ef 100644 --- a/gno/p/dao_roles_voting_group/roles_voting_group.gno +++ b/gno/p/dao_roles_voting_group/roles_voting_group.gno @@ -7,6 +7,7 @@ import ( "gno.land/p/demo/json" dao_interfaces "gno.land/p/teritori/dao_interfaces" + "gno.land/p/teritori/dao_roles_group" "gno.land/p/teritori/havl" "gno.land/p/teritori/jsonutil" ) @@ -30,15 +31,15 @@ func (m *Member) FromJSON(ast *json.Node) { } type RolesVotingGroup struct { - dao_interfaces.IVotingModule - powerByAddr *havl.Tree // std.Address -> uint64 totalPower *havl.Tree // "" -> uint64 memberCount *havl.Tree // "" -> uint32 - rolesModule dao_interfaces.IRolesModule + rolesModule *dao_roles_group.RolesGroup } -func NewRolesVotingGroup(rm dao_interfaces.IRolesModule) *RolesVotingGroup { +var _ dao_interfaces.IVotingModule = (*RolesVotingGroup)(nil) + +func NewRolesVotingGroup(rm *dao_roles_group.RolesGroup) *RolesVotingGroup { return &RolesVotingGroup{ powerByAddr: havl.NewTree(), totalPower: havl.NewTree(), diff --git a/gno/p/dao_roles_voting_group/roles_voting_group_test.gno b/gno/p/dao_roles_voting_group/roles_voting_group_test.gno index 39eb14d08a..b6baa9c1b2 100644 --- a/gno/p/dao_roles_voting_group/roles_voting_group_test.gno +++ b/gno/p/dao_roles_voting_group/roles_voting_group_test.gno @@ -15,7 +15,7 @@ var ( func TestRolesVotingGroup(t *testing.T) { rm := dao_roles_group.NewRolesGroup() - var j dao_interfaces.IRolesModule + var j *dao_roles_group.RolesGroup j = rm rv := NewRolesVotingGroup(j) var i dao_interfaces.IVotingModule diff --git a/gno/p/havl/havl.gno b/gno/p/havl/havl.gno index 2be4a4a0ae..61c7b24801 100644 --- a/gno/p/havl/havl.gno +++ b/gno/p/havl/havl.gno @@ -13,7 +13,7 @@ type Tree struct { initialHeight int64 } -var Latest = int64(0) +const Latest = int64(0) // FIXME: this is not optimized at all, we make a full copy on write diff --git a/gno/r/dao_realm/dao_realm.gno b/gno/r/dao_realm/dao_realm.gno index fc2d028149..c9be11cc4d 100644 --- a/gno/r/dao_realm/dao_realm.gno +++ b/gno/r/dao_realm/dao_realm.gno @@ -38,11 +38,6 @@ func init() { return group } - rolesModuleFactory := func(core dao_interfaces.IDAOCore) dao_interfaces.IRolesModule { - roles = dao_roles_group.NewRolesGroup() - return roles - } - // TODO: consider using factories that return multiple modules and handlers proposalModulesFactories := []dao_interfaces.ProposalModuleFactory{ @@ -82,7 +77,7 @@ func init() { }, } - daoCore = dao_core.NewDAOCore(votingModuleFactory, rolesModuleFactory, proposalModulesFactories, messageHandlersFactories) + daoCore = dao_core.NewDAOCore(votingModuleFactory, proposalModulesFactories, messageHandlersFactories) // Register the DAO profile profile.SetStringField(profile.DisplayName, "DAO Realm") @@ -148,3 +143,7 @@ func getProposalJSON(moduleIndex int, proposalIndex int) string { module := dao_core.GetProposalModule(daoCore, moduleIndex) return module.Module.ProposalJSON(proposalIndex) } + +func getMembersJSON(start, end string, limit uint64) string { + return daoCore.VotingModule().GetMembersJSON(start, end, limit, std.GetHeight()) +} diff --git a/gno/r/dao_roles_realm.gno/dao_roles_realm.gno b/gno/r/dao_roles_realm.gno/dao_roles_realm.gno index 6319c3ff6b..f44253c377 100644 --- a/gno/r/dao_roles_realm.gno/dao_roles_realm.gno +++ b/gno/r/dao_roles_realm.gno/dao_roles_realm.gno @@ -6,12 +6,14 @@ import ( "std" "time" + "gno.land/p/demo/json" dao_core "gno.land/p/teritori/dao_core" dao_interfaces "gno.land/p/teritori/dao_interfaces" proposal_single "gno.land/p/teritori/dao_proposal_single" "gno.land/p/teritori/dao_roles_group" roles_voting_group "gno.land/p/teritori/dao_roles_voting_group" "gno.land/p/teritori/dao_utils" + "gno.land/p/teritori/jsonutil" "gno.land/r/demo/profile" "gno.land/r/teritori/dao_registry" "gno.land/r/teritori/social_feeds" @@ -28,20 +30,17 @@ var ( ) func init() { - rolesModuleFactory := func(core dao_interfaces.IDAOCore) dao_interfaces.IRolesModule { - roles = dao_roles_group.NewRolesGroup() - roles.NewRoleJSON("admin", "[{\"resource\": \"social_feed\", \"power\": \"25\"}, {\"resource\": \"organizations\", \"power\": \"100\"}]") - roles.NewRoleJSON("moderator", "[{\"resource\": \"social_feed\", \"power\": \"10\"}]") - roles.NewRoleJSON("member", "[]") - roles.GrantRole("g1747t5m2f08plqjlrjk2q0qld7465hxz8gkx59c", "admin") - roles.GrantRole("g108cszmcvs4r3k67k7h5zuhm4el3qhlrxzhshtv", "moderator") - roles.GrantRole("g14u5eaheavy0ux4dmpykg2gvxpvqvexm9cyg58a", "member") - roles.GrantRole("g1ckn395mpttp0vupgtratyufdaakgh8jgkmr3ym", "member") - return roles - } + roles = dao_roles_group.NewRolesGroup() + roles.NewRoleJSON("admin", "[{\"resource\": \"social_feed\", \"power\": \"25\"}, {\"resource\": \"organizations\", \"power\": \"100\"}]") + roles.NewRoleJSON("moderator", "[{\"resource\": \"social_feed\", \"power\": \"10\"}]") + roles.NewRoleJSON("member", "[]") + roles.GrantRole("g1747t5m2f08plqjlrjk2q0qld7465hxz8gkx59c", "admin") + roles.GrantRole("g108cszmcvs4r3k67k7h5zuhm4el3qhlrxzhshtv", "moderator") + roles.GrantRole("g14u5eaheavy0ux4dmpykg2gvxpvqvexm9cyg58a", "member") + roles.GrantRole("g1ckn395mpttp0vupgtratyufdaakgh8jgkmr3ym", "member") votingModuleFactory := func(core dao_interfaces.IDAOCore) dao_interfaces.IVotingModule { - group = roles_voting_group.NewRolesVotingGroup(core.RolesModule()) + group = roles_voting_group.NewRolesVotingGroup(roles) group.SetMemberPower("g1747t5m2f08plqjlrjk2q0qld7465hxz8gkx59c", 1) group.SetMemberPower("g108cszmcvs4r3k67k7h5zuhm4el3qhlrxzhshtv", 1) group.SetMemberPower("g14u5eaheavy0ux4dmpykg2gvxpvqvexm9cyg58a", 1) @@ -89,7 +88,7 @@ func init() { }, } - daoCore = dao_core.NewDAOCore(votingModuleFactory, rolesModuleFactory, proposalModulesFactories, messageHandlersFactories) + daoCore = dao_core.NewDAOCore(votingModuleFactory, proposalModulesFactories, messageHandlersFactories) // Register the DAO profile profile.SetStringField(profile.DisplayName, "DAO Realm") @@ -155,3 +154,25 @@ func getProposalJSON(moduleIndex int, proposalIndex int) string { module := dao_core.GetProposalModule(daoCore, moduleIndex) return module.Module.ProposalJSON(proposalIndex) } + +func getMembersJSON(start, end string, limit uint64) string { + vMembers := daoCore.VotingModule().GetMembersJSON(start, end, limit, std.GetHeight()) + nodes, err := json.Unmarshal([]byte(vMembers)) + if err != nil { + panic("failed to unmarshal voting module members") + } + vals := nodes.MustArray() + for i, val := range vals { + obj := val.MustObject() + addr := jsonutil.MustAddress(obj["address"]) + roles := roles.GetMemberRoles(addr) + rolesJSON := make([]*json.Node, len(roles)) + for j, role := range roles { + rolesJSON[j] = json.StringNode("", role) + } + obj["roles"] = json.ArrayNode("", rolesJSON) + vals[i] = json.ObjectNode("", obj) + + } + return json.ArrayNode("", vals).String() +} diff --git a/networks.json b/networks.json index f0a178c5a8..b782b92608 100644 --- a/networks.json +++ b/networks.json @@ -4579,7 +4579,7 @@ "daoProposalSinglePkgPath": "gno.land/p/teritori/dao_proposal_single", "daoInterfacesPkgPath": "gno.land/p/teritori/dao_interfaces", "daoCorePkgPath": "gno.land/p/teritori/dao_core", - "daoUtilsPkgPath": "gno.land/r/teritori/dao_utils", + "daoUtilsPkgPath": "gno.land/p/teritori/dao_utils", "toriPkgPath": "gno.land/r/teritori/tori", "profilePkgPath": "gno.land/r/demo/profile", "txIndexerURL": "https://indexer.portal-loop.gno.testnet.teritori.com" diff --git a/packages/hooks/dao/useDAOMembers.ts b/packages/hooks/dao/useDAOMembers.ts index 3e857088f2..a605f9915e 100644 --- a/packages/hooks/dao/useDAOMembers.ts +++ b/packages/hooks/dao/useDAOMembers.ts @@ -16,7 +16,7 @@ import { extractGnoJSONString } from "@/utils/gno"; type GnoDAOMember = { address: string; power: number; - roles: string[]; + roles?: string[]; }; export const useDAOMembers = (daoId: string | undefined) => { @@ -55,13 +55,13 @@ export const useDAOMembers = (daoId: string | undefined) => { const res: GnoDAOMember[] = extractGnoJSONString( await provider.evaluateExpression( daoAddress, - `daoCore.GetMembersJSON("", "", 0, 0)`, + `getMembersJSON("", "", 0)`, ), ); return res.map((member) => ({ addr: member.address, weight: member.power, - roles: member.roles, + roles: member.roles || [], })); } } diff --git a/packages/networks/gno-portal/index.ts b/packages/networks/gno-portal/index.ts index 767f1a3fb1..d53469683e 100644 --- a/packages/networks/gno-portal/index.ts +++ b/packages/networks/gno-portal/index.ts @@ -39,7 +39,7 @@ export const gnoPortalNetwork: GnoNetworkInfo = { daoProposalSinglePkgPath: "gno.land/p/teritori/dao_proposal_single", daoInterfacesPkgPath: "gno.land/p/teritori/dao_interfaces", daoCorePkgPath: "gno.land/p/teritori/dao_core", - daoUtilsPkgPath: "gno.land/r/teritori/dao_utils", + daoUtilsPkgPath: "gno.land/p/teritori/dao_utils", toriPkgPath: "gno.land/r/teritori/tori", profilePkgPath: "gno.land/r/demo/profile", txIndexerURL: "https://indexer.portal-loop.gno.testnet.teritori.com", diff --git a/packages/scripts/generateDAOSource.ts b/packages/scripts/generateDAOSource.ts new file mode 100644 index 0000000000..0a96871f5c --- /dev/null +++ b/packages/scripts/generateDAOSource.ts @@ -0,0 +1,60 @@ +import { program } from "commander"; +import { z } from "zod"; + +import { gnoDevNetwork } from "@/networks/gno-dev"; +import { GnoDAOConfig } from "@/utils/gnodao/deploy"; +import { generateMembershipDAOSource } from "@/utils/gnodao/generateMembershipDAOSource"; +import { generateRolesDAOSource } from "@/utils/gnodao/generateRolesDAOSource"; + +// example usage: `npx tsx packages/scripts/generateDAOSource.ts roles | gofmt > my_dao.gno` + +const kindSchema = z.union([z.literal("membership"), z.literal("roles")]); + +const main = () => { + const [kindArg] = program.argument("").parse().args; + const kind = kindSchema.parse(kindArg); + + const network = gnoDevNetwork; + + const config: GnoDAOConfig = { + name: "my_dao", + displayName: "My DAO", + description: "Some DAO", + imageURI: + "https://images.unsplash.com/photo-1477959858617-67f85cf4f1df?w=1080&fit=max", + maxVotingPeriodSeconds: 60 * 60 * 24 * 42, // 42 days + roles: [ + { name: "fooer", color: "#111111", resources: ["fooing"] }, + { name: "barer", color: "#777777", resources: ["baring", "bazing"] }, + ], + initialMembers: [ + { + address: "g1fakeaddr", + weight: 42, + roles: ["fooer", "barer"], + }, + { + address: "g1fakeaddr2", + weight: 21, + roles: [], + }, + ], + thresholdPercent: 0.66, + quorumPercent: 0.33, + }; + + let source: string; + switch (kind) { + case "membership": + source = generateMembershipDAOSource(network.id, config); + break; + case "roles": + source = generateRolesDAOSource(network.id, config); + break; + default: + throw new Error("unknown dao structure"); + } + console.log(source); +}; + +main(); diff --git a/packages/utils/gnodao/generateMembershipDAOSource.ts b/packages/utils/gnodao/generateMembershipDAOSource.ts index 8e0fe7542c..b9d3ae7e92 100644 --- a/packages/utils/gnodao/generateMembershipDAOSource.ts +++ b/packages/utils/gnodao/generateMembershipDAOSource.ts @@ -10,12 +10,12 @@ export const generateMembershipDAOSource = ( return `package ${conf.name} import ( + "std" "time" dao_core "${network.daoCorePkgPath}" dao_interfaces "${network.daoInterfacesPkgPath}" proposal_single "${network.daoProposalSinglePkgPath}" - "${network.rolesGroupPkgPath}" "${network.daoUtilsPkgPath}" "${network.profilePkgPath}" voting_group "${network.votingGroupPkgPath}" @@ -23,35 +23,26 @@ export const generateMembershipDAOSource = ( "${network.socialFeedsPkgPath}" ) -var ( - daoCore dao_interfaces.IDAOCore - group *voting_group.VotingGroup - roles *dao_roles_group.RolesGroup - registered bool -) - -func init() { - votingModuleFactory := func(core dao_interfaces.IDAOCore) dao_interfaces.IVotingModule { - group = voting_group.NewVotingGroup() - ${conf.initialMembers - .map( - (member) => - `group.SetMemberPower("${member.address}", ${member.weight})`, - ) - .join("\n\t")} - return group - } - - rolesModuleFactory := func(core dao_interfaces.IDAOCore) dao_interfaces.IRolesModule { - roles = dao_roles_group.NewRolesGroup() - ${(conf.roles ?? []).map((role) => `roles.NewRole("${role}", "");`).join("\n\t")} - ${conf.initialMembers.map((member) => member.roles.map((role) => `roles.GrantRole("${member.address}", "${role}")`).join("\n\t"))} - return roles - } + var ( + daoCore dao_interfaces.IDAOCore + group *voting_group.VotingGroup + registered bool + ) + func init() { + votingModuleFactory := func(core dao_interfaces.IDAOCore) dao_interfaces.IVotingModule { + group = voting_group.NewVotingGroup() + ${conf.initialMembers + .map( + (member) => + `group.SetMemberPower("${member.address}", ${member.weight})`, + ) + .join("\n\t")} + return group + } // TODO: consider using factories that return multiple modules and handlers - + proposalModulesFactories := []dao_interfaces.ProposalModuleFactory{ func(core dao_interfaces.IDAOCore) dao_interfaces.IProposalModule { tt := proposal_single.PercentageThresholdPercent(${Math.ceil( @@ -69,29 +60,29 @@ func init() { }) }, } - - messageHandlersFactories := []dao_interfaces.MessageHandlerFactory{ - func(core dao_interfaces.IDAOCore) dao_interfaces.MessageHandler { - return group.UpdateMembersHandler() - }, - func(core dao_interfaces.IDAOCore) dao_interfaces.MessageHandler { - // TODO: add a router to support multiple proposal modules - propMod := core.ProposalModules()[0] - return proposal_single.NewUpdateSettingsHandler(propMod.Module.(*proposal_single.DAOProposalSingle)) - }, - func(core dao_interfaces.IDAOCore) dao_interfaces.MessageHandler { - return social_feeds.NewCreatePostHandler() - }, - } - - daoCore = dao_core.NewDAOCore(votingModuleFactory, rolesModuleFactory, proposalModulesFactories, messageHandlersFactories) - - // Register the DAO profile - profile.SetStringField(profile.DisplayName, "${conf.displayName}") - profile.SetStringField(profile.Bio, "${conf.description}") - profile.SetStringField(profile.Avatar, "${conf.imageURI}") - - dao_registry.Register(func() dao_interfaces.IDAOCore { return daoCore }, "${conf.displayName}", "${conf.description}", "${conf.imageURI}") + + messageHandlersFactories := []dao_interfaces.MessageHandlerFactory{ + func(core dao_interfaces.IDAOCore) dao_interfaces.MessageHandler { + return group.UpdateMembersHandler() + }, + func(core dao_interfaces.IDAOCore) dao_interfaces.MessageHandler { + // TODO: add a router to support multiple proposal modules + propMod := core.ProposalModules()[0] + return proposal_single.NewUpdateSettingsHandler(propMod.Module.(*proposal_single.DAOProposalSingle)) + }, + func(core dao_interfaces.IDAOCore) dao_interfaces.MessageHandler { + return social_feeds.NewCreatePostHandler() + }, + } + + daoCore = dao_core.NewDAOCore(votingModuleFactory, proposalModulesFactories, messageHandlersFactories) + + // Register the DAO profile + profile.SetStringField(profile.DisplayName, "${conf.displayName}") + profile.SetStringField(profile.Bio, "${conf.description}") + profile.SetStringField(profile.Avatar, "${conf.imageURI}") + + dao_registry.Register(func() dao_interfaces.IDAOCore { return daoCore }, "${conf.displayName}", "${conf.description}", "${conf.imageURI}") } func Render(path string) string { @@ -139,5 +130,9 @@ func init() { module := dao_core.GetProposalModule(daoCore, moduleIndex) return module.Module.ProposalJSON(proposalIndex) } + + func getMembersJSON(start, end string, limit uint64) string { + return daoCore.VotingModule().GetMembersJSON(start, end, limit, std.GetHeight()) + } `; }; diff --git a/packages/utils/gnodao/generateRolesDAOSource.ts b/packages/utils/gnodao/generateRolesDAOSource.ts index 93d30f392a..2dfafa3844 100644 --- a/packages/utils/gnodao/generateRolesDAOSource.ts +++ b/packages/utils/gnodao/generateRolesDAOSource.ts @@ -9,6 +9,7 @@ export const generateRolesDAOSource = ( return `package ${conf.name} import ( + "std" "time" dao_core "${network.daoCorePkgPath}" @@ -16,10 +17,12 @@ export const generateRolesDAOSource = ( proposal_single "${network.daoProposalSinglePkgPath}" "${network.rolesGroupPkgPath}" "${network.daoUtilsPkgPath}" + "gno.land/p/teritori/jsonutil" "${network.profilePkgPath}" voting_group "${network.rolesVotingGroupPkgPath}" "${network.daoRegistryPkgPath}" "${network.socialFeedsPkgPath}" + "gno.land/p/demo/json" ) var ( @@ -30,32 +33,29 @@ var ( ) func init() { - rolesModuleFactory := func(core dao_interfaces.IDAOCore) dao_interfaces.IRolesModule { - roles = dao_roles_group.NewRolesGroup() - ${(conf.roles ?? []) - .map( - (role) => - `roles.NewRoleJSON("${role.name}", "[${(role.resources ?? []) - .map( - (resource) => - `{\\"resource\\": \\"${resource}\\", \\"power\\": \\"999\\"}`, - ) - .join(", ")}]")`, - ) - .join("\n\t")} - ${conf.initialMembers - .filter((member) => member.roles.length > 0) - .map((member) => - member.roles - .map((role) => `roles.GrantRole("${member.address}", "${role}")`) - .join("\n\t"), - ) - .join("\n\t")} - return roles - } + roles = dao_roles_group.NewRolesGroup() + ${(conf.roles ?? []) + .map( + (role) => + `roles.NewRoleJSON("${role.name}", "[${(role.resources ?? []) + .map( + (resource) => + `{\\"resource\\": \\"${resource}\\", \\"power\\": \\"999\\"}`, + ) + .join(", ")}]")`, + ) + .join("\n\t")} + ${conf.initialMembers + .filter((member) => member.roles.length > 0) + .map((member) => + member.roles + .map((role) => `roles.GrantRole("${member.address}", "${role}")`) + .join("\n\t"), + ) + .join("\n\t")} votingModuleFactory := func(core dao_interfaces.IDAOCore) dao_interfaces.IVotingModule { - group = voting_group.NewRolesVotingGroup(core.RolesModule()) + group = voting_group.NewRolesVotingGroup(roles) ${conf.initialMembers .map( (member) => @@ -100,7 +100,7 @@ func init() { }, } - daoCore = dao_core.NewDAOCore(votingModuleFactory, rolesModuleFactory, proposalModulesFactories, messageHandlersFactories) + daoCore = dao_core.NewDAOCore(votingModuleFactory, proposalModulesFactories, messageHandlersFactories) // Register the DAO profile profile.SetStringField(profile.DisplayName, "${conf.displayName}") @@ -155,5 +155,28 @@ func init() { module := dao_core.GetProposalModule(daoCore, moduleIndex) return module.Module.ProposalJSON(proposalIndex) } + + + func getMembersJSON(start, end string, limit uint64) string { + vMembers := daoCore.VotingModule().GetMembersJSON(start, end, limit, std.GetHeight()) + nodes, err := json.Unmarshal([]byte(vMembers)) + if err != nil { + panic("failed to unmarshal voting module members") + } + vals := nodes.MustArray() + for i, val := range vals { + obj := val.MustObject() + addr := jsonutil.MustAddress(obj["address"]) + roles := roles.GetMemberRoles(addr) + rolesJSON := make([]*json.Node, len(roles)) + for j, role := range roles { + rolesJSON[j] = json.StringNode("", role) + } + obj["roles"] = json.ArrayNode("", rolesJSON) + vals[i] = json.ObjectNode("", obj) + + } + return json.ArrayNode("", vals).String() + } `; }; From 3d27860d49599761eb437bd7fc7b52dccd5a07f9 Mon Sep 17 00:00:00 2001 From: n0izn0iz Date: Sun, 29 Dec 2024 21:43:29 +0100 Subject: [PATCH 11/20] chore: make tests pass gnopls linter (#1467) Signed-off-by: Norman --- gno/r/dao_realm/dao_realm_test.gno | 16 ++++++++-------- .../dao_roles_realm.gno/dao_roles_realm_test.gno | 16 ++++++++-------- gno/r/launchpad_grc20/airdrop_grc20_test.gno | 14 ++++---------- gno/r/launchpad_grc20/sale_grc20_test.gno | 3 +-- gno/r/social_feeds/feeds_test.gno | 16 ++++++++-------- 5 files changed, 29 insertions(+), 36 deletions(-) diff --git a/gno/r/dao_realm/dao_realm_test.gno b/gno/r/dao_realm/dao_realm_test.gno index 202b4772a7..dc8ce2ff4c 100644 --- a/gno/r/dao_realm/dao_realm_test.gno +++ b/gno/r/dao_realm/dao_realm_test.gno @@ -1,10 +1,10 @@ package dao_realm import ( - "fmt" "testing" "gno.land/p/demo/json" + "gno.land/p/demo/ufmt" "gno.land/p/teritori/dao_voting_group" "gno.land/p/teritori/havl" ) @@ -37,7 +37,7 @@ func TestUpdateMembers(t *testing.T) { var membersJSON string { - id := ProposeJSON(0, fmt.Sprintf(`{"title": "Test prop", "description": "A description", "messages": [{"type": "gno.land/p/teritori/dao_voting_group.UpdateMembers", "payload": [{"power": "2", "address": "g18syxa0vh0vmne90mwhtynjet0zgeqf6prh3ryy"}]}]}`)) + id := ProposeJSON(0, ufmt.Sprintf(`{"title": "Test prop", "description": "A description", "messages": [{"type": "gno.land/p/teritori/dao_voting_group.UpdateMembers", "payload": [{"power": "2", "address": "g18syxa0vh0vmne90mwhtynjet0zgeqf6prh3ryy"}]}]}`)) VoteJSON(0, id, `{"vote": "Yes", "rationale": "testing"}`) Execute(0, id) members := group.GetMembers("", "", 0, havl.Latest) @@ -47,7 +47,7 @@ func TestUpdateMembers(t *testing.T) { } membersJSON = json.ArrayNode("", iSlice).String() - expected := fmt.Sprintf(`[{"address":"g108cszmcvs4r3k67k7h5zuhm4el3qhlrxzhshtv","power":"1"},{"address":"g14u5eaheavy0ux4dmpykg2gvxpvqvexm9cyg58a","power":"1"},{"address":"g1747t5m2f08plqjlrjk2q0qld7465hxz8gkx59c","power":"1"},{"address":"g18syxa0vh0vmne90mwhtynjet0zgeqf6prh3ryy","power":"2"},{"address":"g1ckn395mpttp0vupgtratyufdaakgh8jgkmr3ym","power":"1"},{"address":"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm","power":"1"}]`) + expected := ufmt.Sprintf(`[{"address":"g108cszmcvs4r3k67k7h5zuhm4el3qhlrxzhshtv","power":"1"},{"address":"g14u5eaheavy0ux4dmpykg2gvxpvqvexm9cyg58a","power":"1"},{"address":"g1747t5m2f08plqjlrjk2q0qld7465hxz8gkx59c","power":"1"},{"address":"g18syxa0vh0vmne90mwhtynjet0zgeqf6prh3ryy","power":"2"},{"address":"g1ckn395mpttp0vupgtratyufdaakgh8jgkmr3ym","power":"1"},{"address":"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm","power":"1"}]`) if membersJSON != expected { t.Errorf("Expected:\n%s\nGot:\n%s", expected, membersJSON) } @@ -67,7 +67,7 @@ func TestUpdateMembers(t *testing.T) { var member dao_voting_group.Member member.FromJSON(children[0]) - id := ProposeJSON(0, fmt.Sprintf(`{"title": "Test prop 2", "description": "A description", "messages": [{"type": "gno.land/p/teritori/dao_voting_group.UpdateMembers", "payload": [{"address": "%s", "power": "0"}]}]}`, member.Address.String())) + id := ProposeJSON(0, ufmt.Sprintf(`{"title": "Test prop 2", "description": "A description", "messages": [{"type": "gno.land/p/teritori/dao_voting_group.UpdateMembers", "payload": [{"address": "%s", "power": "0"}]}]}`, member.Address.String())) VoteJSON(0, id, `{"vote": "Yes", "rationale": "testing"}`) Execute(0, id) members := group.GetMembers("", "", 0, havl.Latest) @@ -93,11 +93,11 @@ func TestUpdateSettings(t *testing.T) { // not sure why but in this test the proposal ids start at 3 and the voting power is 5 when all tests are run, shouldn't tests be isolated? TODO: investigate { - id := ProposeJSON(0, fmt.Sprintf(`{"title": "Test prop", "description": "A description", "messages": [{"type": "gno.land/p/teritori/dao_proposal_single.UpdateSettings", "payload": {"threshold": {"thresholdQuorum": {"threshold": {"percent": 200}, "quorum": {"percent": 200}}}}}]}`)) + id := ProposeJSON(0, ufmt.Sprintf(`{"title": "Test prop", "description": "A description", "messages": [{"type": "gno.land/p/teritori/dao_proposal_single.UpdateSettings", "payload": {"threshold": {"thresholdQuorum": {"threshold": {"percent": 200}, "quorum": {"percent": 200}}}}}]}`)) VoteJSON(0, id, `{"vote": "Yes", "rationale": "testing"}`) Execute(0, id) proposalJSON := getProposalJSON(0, id) - expected := fmt.Sprintf(`{"id":"%d","title":"Test prop","description":"A description","proposer":"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm","startHeight":"123","totalPower":"6","messages":[{"type":"gno.land/p/teritori/dao_proposal_single.UpdateSettings","payload":{"threshold":{"thresholdQuorum":{"threshold":{"percent":200},"quorum":{"percent":200}}}}}],"status":"Executed","votes":{"yes":"1","no":"0","abstain":"0"},"allowRevoting":false,"ballots":{"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm":{"power":"1","vote":"Yes","rationale":"testing"}},"expiration":{"atTime":"2009-03-27T23:31:30Z"},"threshold":{"thresholdQuorum":{"threshold":{"percent":100},"quorum":{"percent":100}}}}`, id) + expected := ufmt.Sprintf(`{"id":"%d","title":"Test prop","description":"A description","proposer":"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm","startHeight":"123","totalPower":"6","messages":[{"type":"gno.land/p/teritori/dao_proposal_single.UpdateSettings","payload":{"threshold":{"thresholdQuorum":{"threshold":{"percent":200},"quorum":{"percent":200}}}}}],"status":"Executed","votes":{"yes":"1","no":"0","abstain":"0"},"allowRevoting":false,"ballots":{"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm":{"power":"1","vote":"Yes","rationale":"testing"}},"expiration":{"atTime":"2009-03-27T23:31:30Z"},"threshold":{"thresholdQuorum":{"threshold":{"percent":100},"quorum":{"percent":100}}}}`, id) if proposalJSON != expected { t.Fatalf("Expected:\n%s\nGot:\n%s", expected, proposalJSON) } @@ -105,11 +105,11 @@ func TestUpdateSettings(t *testing.T) { { // make sentiment proposal - id := ProposeJSON(0, fmt.Sprintf(`{"title": "Test prop", "description": "A description", "messages": []}`)) + id := ProposeJSON(0, ufmt.Sprintf(`{"title": "Test prop", "description": "A description", "messages": []}`)) VoteJSON(0, id, `{"vote": "Yes", "rationale": "testing"}`) Execute(0, id) proposalJSON := getProposalJSON(0, id) - expected := fmt.Sprintf(`{"id":"%d","title":"Test prop","description":"A description","proposer":"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm","startHeight":"123","totalPower":"6","messages":[],"status":"Executed","votes":{"yes":"1","no":"0","abstain":"0"},"allowRevoting":false,"ballots":{"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm":{"power":"1","vote":"Yes","rationale":"testing"}},"expiration":{"atTime":"2009-03-27T23:31:30Z"},"threshold":{"thresholdQuorum":{"threshold":{"percent":200},"quorum":{"percent":200}}}}`, id) + expected := ufmt.Sprintf(`{"id":"%d","title":"Test prop","description":"A description","proposer":"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm","startHeight":"123","totalPower":"6","messages":[],"status":"Executed","votes":{"yes":"1","no":"0","abstain":"0"},"allowRevoting":false,"ballots":{"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm":{"power":"1","vote":"Yes","rationale":"testing"}},"expiration":{"atTime":"2009-03-27T23:31:30Z"},"threshold":{"thresholdQuorum":{"threshold":{"percent":200},"quorum":{"percent":200}}}}`, id) if proposalJSON != expected { t.Fatalf("Expected:\n%s\nGot:\n%s", expected, proposalJSON) } diff --git a/gno/r/dao_roles_realm.gno/dao_roles_realm_test.gno b/gno/r/dao_roles_realm.gno/dao_roles_realm_test.gno index aa817a27a9..bba0f96176 100644 --- a/gno/r/dao_roles_realm.gno/dao_roles_realm_test.gno +++ b/gno/r/dao_roles_realm.gno/dao_roles_realm_test.gno @@ -1,10 +1,10 @@ package dao_roles_realm import ( - "fmt" "testing" "gno.land/p/demo/json" + "gno.land/p/demo/ufmt" "gno.land/p/teritori/dao_voting_group" "gno.land/p/teritori/havl" ) @@ -37,7 +37,7 @@ func TestUpdateMembers(t *testing.T) { var membersJSON string { - id := ProposeJSON(0, fmt.Sprintf(`{"title": "Test prop", "description": "A description", "messages": [{"type": "gno.land/p/teritori/dao_voting_group.UpdateMembers", "payload": [{"power": "2", "address": "g18syxa0vh0vmne90mwhtynjet0zgeqf6prh3ryy"}]}]}`)) + id := ProposeJSON(0, ufmt.Sprintf(`{"title": "Test prop", "description": "A description", "messages": [{"type": "gno.land/p/teritori/dao_voting_group.UpdateMembers", "payload": [{"power": "2", "address": "g18syxa0vh0vmne90mwhtynjet0zgeqf6prh3ryy"}]}]}`)) VoteJSON(0, id, `{"vote": "Yes", "rationale": "testing"}`) Execute(0, id) members := group.GetMembers("", "", 0, havl.Latest) @@ -47,7 +47,7 @@ func TestUpdateMembers(t *testing.T) { } membersJSON = json.ArrayNode("", iSlice).String() - expected := fmt.Sprintf(`[{"address":"g108cszmcvs4r3k67k7h5zuhm4el3qhlrxzhshtv","power":"1"},{"address":"g14u5eaheavy0ux4dmpykg2gvxpvqvexm9cyg58a","power":"1"},{"address":"g1747t5m2f08plqjlrjk2q0qld7465hxz8gkx59c","power":"1"},{"address":"g18syxa0vh0vmne90mwhtynjet0zgeqf6prh3ryy","power":"2"},{"address":"g1ckn395mpttp0vupgtratyufdaakgh8jgkmr3ym","power":"1"},{"address":"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm","power":"1"}]`) + expected := ufmt.Sprintf(`[{"address":"g108cszmcvs4r3k67k7h5zuhm4el3qhlrxzhshtv","power":"1"},{"address":"g14u5eaheavy0ux4dmpykg2gvxpvqvexm9cyg58a","power":"1"},{"address":"g1747t5m2f08plqjlrjk2q0qld7465hxz8gkx59c","power":"1"},{"address":"g18syxa0vh0vmne90mwhtynjet0zgeqf6prh3ryy","power":"2"},{"address":"g1ckn395mpttp0vupgtratyufdaakgh8jgkmr3ym","power":"1"},{"address":"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm","power":"1"}]`) if membersJSON != expected { t.Errorf("Expected:\n%s\nGot:\n%s", expected, membersJSON) } @@ -67,7 +67,7 @@ func TestUpdateMembers(t *testing.T) { var member dao_voting_group.Member member.FromJSON(children[0]) - id := ProposeJSON(0, fmt.Sprintf(`{"title": "Test prop 2", "description": "A description", "messages": [{"type": "gno.land/p/teritori/dao_voting_group.UpdateMembers", "payload": [{"address": "%s", "power": "0"}]}]}`, member.Address.String())) + id := ProposeJSON(0, ufmt.Sprintf(`{"title": "Test prop 2", "description": "A description", "messages": [{"type": "gno.land/p/teritori/dao_voting_group.UpdateMembers", "payload": [{"address": "%s", "power": "0"}]}]}`, member.Address.String())) VoteJSON(0, id, `{"vote": "Yes", "rationale": "testing"}`) Execute(0, id) members := group.GetMembers("", "", 0, havl.Latest) @@ -93,11 +93,11 @@ func TestUpdateSettings(t *testing.T) { // not sure why but in this test the proposal ids start at 3 and the voting power is 5 when all tests are run, shouldn't tests be isolated? TODO: investigate { - id := ProposeJSON(0, fmt.Sprintf(`{"title": "Test prop", "description": "A description", "messages": [{"type": "gno.land/p/teritori/dao_proposal_single.UpdateSettings", "payload": {"threshold": {"thresholdQuorum": {"threshold": {"percent": 200}, "quorum": {"percent": 200}}}}}]}`)) + id := ProposeJSON(0, ufmt.Sprintf(`{"title": "Test prop", "description": "A description", "messages": [{"type": "gno.land/p/teritori/dao_proposal_single.UpdateSettings", "payload": {"threshold": {"thresholdQuorum": {"threshold": {"percent": 200}, "quorum": {"percent": 200}}}}}]}`)) VoteJSON(0, id, `{"vote": "Yes", "rationale": "testing"}`) Execute(0, id) proposalJSON := getProposalJSON(0, id) - expected := fmt.Sprintf(`{"id":"%d","title":"Test prop","description":"A description","proposer":"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm","startHeight":"123","totalPower":"6","messages":[{"type":"gno.land/p/teritori/dao_proposal_single.UpdateSettings","payload":{"threshold":{"thresholdQuorum":{"threshold":{"percent":200},"quorum":{"percent":200}}}}}],"status":"Executed","votes":{"yes":"1","no":"0","abstain":"0"},"allowRevoting":false,"ballots":{"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm":{"power":"1","vote":"Yes","rationale":"testing"}},"expiration":{"atTime":"2009-03-27T23:31:30Z"},"threshold":{"thresholdQuorum":{"threshold":{"percent":100},"quorum":{"percent":100}}}}`, id) + expected := ufmt.Sprintf(`{"id":"%d","title":"Test prop","description":"A description","proposer":"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm","startHeight":"123","totalPower":"6","messages":[{"type":"gno.land/p/teritori/dao_proposal_single.UpdateSettings","payload":{"threshold":{"thresholdQuorum":{"threshold":{"percent":200},"quorum":{"percent":200}}}}}],"status":"Executed","votes":{"yes":"1","no":"0","abstain":"0"},"allowRevoting":false,"ballots":{"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm":{"power":"1","vote":"Yes","rationale":"testing"}},"expiration":{"atTime":"2009-03-27T23:31:30Z"},"threshold":{"thresholdQuorum":{"threshold":{"percent":100},"quorum":{"percent":100}}}}`, id) if proposalJSON != expected { t.Fatalf("Expected:\n%s\nGot:\n%s", expected, proposalJSON) } @@ -105,11 +105,11 @@ func TestUpdateSettings(t *testing.T) { { // make sentiment proposal - id := ProposeJSON(0, fmt.Sprintf(`{"title": "Test prop", "description": "A description", "messages": []}`)) + id := ProposeJSON(0, ufmt.Sprintf(`{"title": "Test prop", "description": "A description", "messages": []}`)) VoteJSON(0, id, `{"vote": "Yes", "rationale": "testing"}`) Execute(0, id) proposalJSON := getProposalJSON(0, id) - expected := fmt.Sprintf(`{"id":"%d","title":"Test prop","description":"A description","proposer":"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm","startHeight":"123","totalPower":"6","messages":[],"status":"Executed","votes":{"yes":"1","no":"0","abstain":"0"},"allowRevoting":false,"ballots":{"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm":{"power":"1","vote":"Yes","rationale":"testing"}},"expiration":{"atTime":"2009-03-27T23:31:30Z"},"threshold":{"thresholdQuorum":{"threshold":{"percent":200},"quorum":{"percent":200}}}}`, id) + expected := ufmt.Sprintf(`{"id":"%d","title":"Test prop","description":"A description","proposer":"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm","startHeight":"123","totalPower":"6","messages":[],"status":"Executed","votes":{"yes":"1","no":"0","abstain":"0"},"allowRevoting":false,"ballots":{"g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm":{"power":"1","vote":"Yes","rationale":"testing"}},"expiration":{"atTime":"2009-03-27T23:31:30Z"},"threshold":{"thresholdQuorum":{"threshold":{"percent":200},"quorum":{"percent":200}}}}`, id) if proposalJSON != expected { t.Fatalf("Expected:\n%s\nGot:\n%s", expected, proposalJSON) } diff --git a/gno/r/launchpad_grc20/airdrop_grc20_test.gno b/gno/r/launchpad_grc20/airdrop_grc20_test.gno index 11f260341f..696fd53fab 100644 --- a/gno/r/launchpad_grc20/airdrop_grc20_test.gno +++ b/gno/r/launchpad_grc20/airdrop_grc20_test.gno @@ -1,13 +1,13 @@ package launchpad_grc20 import ( - "fmt" "std" "strconv" "testing" "time" "gno.land/p/demo/merkle" + "gno.land/p/demo/ufmt" ) func TestNewAirdrop(t *testing.T) { @@ -175,18 +175,12 @@ func TestClaimJSON(t *testing.T) { root := tree.Root() proofs, _ := tree.Proof(leaves[0]) - erroneousProofs := []merkle.Node{ - {[]byte("badproof")}, - {[]byte("badproof")}, - } - - now := time.Now().Unix() NewToken("TestClaimJSONAirDropToken", "TestClaimJSONAirDropToken", "noimage", 18, 21_000_000, 23_000_000, true, true) airdropID := NewAirdrop("TestClaimJSONAirDropToken", root, 100, 0, 0) proofsJSON := "[" for i, proof := range proofs { - proofsJSON += fmt.Sprintf("{\"hash\":\"%s\", \"pos\":\"%s\"}", proof.Hash(), strconv.Itoa(int(proof.Position()))) + proofsJSON += ufmt.Sprintf("{\"hash\":\"%s\", \"pos\":\"%s\"}", proof.Hash(), strconv.Itoa(int(proof.Position()))) if i != len(proofs)-1 { proofsJSON += ", " } @@ -259,8 +253,8 @@ func TestClaim(t *testing.T) { proofs, _ := tree.Proof(leaves[0]) erroneousProofs := []merkle.Node{ - {[]byte("badproof")}, - {[]byte("badproof")}, + merkle.NewNode([]byte("badproof"), 0), + merkle.NewNode([]byte("badproof"), 0), } now := time.Now().Unix() diff --git a/gno/r/launchpad_grc20/sale_grc20_test.gno b/gno/r/launchpad_grc20/sale_grc20_test.gno index 7aaa49b485..686b337ca2 100644 --- a/gno/r/launchpad_grc20/sale_grc20_test.gno +++ b/gno/r/launchpad_grc20/sale_grc20_test.gno @@ -331,7 +331,6 @@ func TestBuy(t *testing.T) { badCoin := std.NewCoins(std.NewCoin("notugnot", 100*10)) manyCoins := std.NewCoins(std.NewCoin("ugnot", 100*10), std.NewCoin("notugnot", 100*10)) notEnoughCoins := std.NewCoins(std.NewCoin("ugnot", 100*5)) - tooManyCoins := std.NewCoins(std.NewCoin("ugnot", 100*11)) emptyCoins := std.NewCoins() tests := testBuyTestTable{ @@ -536,7 +535,7 @@ func TestFinalize(t *testing.T) { NewToken("TestFinalizeToken", "TestFinalizeToken", "image", 18, 21_000_000, 23_000_000, true, true) saleID := NewSale("TestFinalizeToken", "", startTimestamp, endTimestamp, 100, 15, 10, 20, true) onGoingSaleID := NewSale("TestFinalizeToken", "", startTimestamp, onGoingEndTimestamp, 100, 15, 10, 20, true) - onGoingSaleID2 := NewSale("TestFinalizeToken", "", startTimestamp, onGoingEndTimestamp2, 100, 15, 10, 20, true) + _ = NewSale("TestFinalizeToken", "", startTimestamp, onGoingEndTimestamp2, 100, 15, 10, 20, true) tests := testFinalizeTestTable{ "Success with 0 tokens sold": { diff --git a/gno/r/social_feeds/feeds_test.gno b/gno/r/social_feeds/feeds_test.gno index 86766e7127..caf6380051 100644 --- a/gno/r/social_feeds/feeds_test.gno +++ b/gno/r/social_feeds/feeds_test.gno @@ -170,7 +170,7 @@ func testCreateAndDeleteComment(t *testing.T) { metadata := `empty_meta_data` - commentID1 := CreatePost(feed1.id, post1.id, cat1, metadata) + _ = CreatePost(feed1.id, post1.id, cat1, metadata) commentID2 := CreatePost(feed1.id, post1.id, cat1, metadata) comment2 := feed1.MustGetPost(commentID2) @@ -255,10 +255,10 @@ func testFilterByCategories(t *testing.T) { postID2 := CreatePost(feed2.id, rootPostID, cat1, "metadata") // Create 1 posts on root with cat2 - postID3 := CreatePost(feed2.id, rootPostID, cat2, "metadata") + _ = CreatePost(feed2.id, rootPostID, cat2, "metadata") // Create comments on post 1 - commentPostID1 := CreatePost(feed2.id, postID1, cat1, "metadata") + _ = CreatePost(feed2.id, postID1, cat1, "metadata") // cat1: Should return max = limit if count := countPosts(feed2.id, filter_cat1, 1); count != 1 { @@ -313,11 +313,11 @@ func testFilterByCategories(t *testing.T) { func testTipPost(t *testing.T) { creator := testutils.TestAddress("creator") - std.TestIssueCoins(creator, std.Coins{{"ugnot", 100_000_000}}) + std.TestIssueCoins(creator, std.Coins{{Denom: "ugnot", Amount: 100_000_000}}) // NOTE: Dont know why the address should be this to be able to call banker (= std.GetCallerAt(1)) tipper := testutils.TestAddress("tipper") - std.TestIssueCoins(tipper, std.Coins{{"ugnot", 50_000_000}}) + std.TestIssueCoins(tipper, std.Coins{{Denom: "ugnot", Amount: 50_000_000}}) banker := std.GetBanker(std.BankerTypeReadonly) @@ -341,7 +341,7 @@ func testTipPost(t *testing.T) { // Tiper tips the ppst std.TestSetOrigCaller(tipper) - std.TestSetOrigSend(std.Coins{{"ugnot", 1_000_000}}, nil) + std.TestSetOrigSend(std.Coins{{Denom: "ugnot", Amount: 1_000_000}}, nil) TipPost(feed3.id, post1.id) // Coin must be increased for creator @@ -355,7 +355,7 @@ func testTipPost(t *testing.T) { } // Add more tip should update this total - std.TestSetOrigSend(std.Coins{{"ugnot", 2_000_000}}, nil) + std.TestSetOrigSend(std.Coins{{Denom: "ugnot", Amount: 2_000_000}}, nil) TipPost(feed3.id, post1.id) if post1.tipAmount != 3_000_000 { @@ -426,7 +426,7 @@ func testHidePostForMe(t *testing.T) { feed8 := mustGetFeed(feedID8) postIDToHide := CreatePost(feed8.id, rootPostID, cat1, `{"metadata": "value"}`) - postID := CreatePost(feed8.id, rootPostID, cat1, `{"metadata": "value"}`) + _ = CreatePost(feed8.id, rootPostID, cat1, `{"metadata": "value"}`) if count := countPosts(feed8.id, filter_all, 10); count != 2 { t.Fatalf("expected posts count: 2, got %q.", count) From b5e1d1e6210b36bf08f44cfdf7a3b3f9b3314b3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=B9=96=DB=A3=DB=9CDadidou?= <50441633+WaDadidou@users.noreply.github.com> Date: Mon, 30 Dec 2024 12:53:50 -0500 Subject: [PATCH 12/20] feat(rakki): UI enhancement (#1434) Co-authored-by: n0izn0iz Co-authored-by: hthieu1110 --- assets/icons/rakki-ticket.svg | 11 + assets/icons/ticket.svg | 9 + assets/logos/rakki-ticket.png | Bin 0 -> 252515 bytes assets/logos/rakki-ticket.svg | 150 ---- .../components/gradientText/GradientText.tsx | 6 +- .../gradientText/GradientText.web.tsx | 6 +- packages/hooks/rakki/useRakkiTicketsByUser.ts | 43 + packages/screens/Rakki/RakkiScreen.tsx | 826 +----------------- .../BuyTickets/BuyTicketsButton.tsx | 53 ++ .../components/BuyTickets/BuyTicketsModal.tsx | 335 +++++++ .../BuyTickets/ModalTicketImage.tsx | 46 + packages/screens/Rakki/components/GameBox.tsx | 115 +++ packages/screens/Rakki/components/Help.tsx | 125 +++ .../screens/Rakki/components/IntroJapText.tsx | 34 + .../components/IntroTicketImageButton.tsx | 29 + .../screens/Rakki/components/PrizeInfo.tsx | 61 ++ .../screens/Rakki/components/RakkiHistory.tsx | 130 +++ .../screens/Rakki/components/RakkiLogo.tsx | 25 + .../screens/Rakki/components/TicketImage.tsx | 15 + .../Rakki/components/TicketsAndPrice.tsx | 36 + .../Rakki/components/TicketsRamaining.tsx | 64 ++ packages/screens/Rakki/styles.ts | 17 + packages/screens/Rakki/utils.ts | 23 + packages/utils/style/colors.ts | 6 +- 24 files changed, 1215 insertions(+), 950 deletions(-) create mode 100644 assets/icons/rakki-ticket.svg create mode 100644 assets/icons/ticket.svg create mode 100644 assets/logos/rakki-ticket.png delete mode 100644 assets/logos/rakki-ticket.svg create mode 100644 packages/hooks/rakki/useRakkiTicketsByUser.ts create mode 100644 packages/screens/Rakki/components/BuyTickets/BuyTicketsButton.tsx create mode 100644 packages/screens/Rakki/components/BuyTickets/BuyTicketsModal.tsx create mode 100644 packages/screens/Rakki/components/BuyTickets/ModalTicketImage.tsx create mode 100644 packages/screens/Rakki/components/GameBox.tsx create mode 100644 packages/screens/Rakki/components/Help.tsx create mode 100644 packages/screens/Rakki/components/IntroJapText.tsx create mode 100644 packages/screens/Rakki/components/IntroTicketImageButton.tsx create mode 100644 packages/screens/Rakki/components/PrizeInfo.tsx create mode 100644 packages/screens/Rakki/components/RakkiHistory.tsx create mode 100644 packages/screens/Rakki/components/RakkiLogo.tsx create mode 100644 packages/screens/Rakki/components/TicketImage.tsx create mode 100644 packages/screens/Rakki/components/TicketsAndPrice.tsx create mode 100644 packages/screens/Rakki/components/TicketsRamaining.tsx create mode 100644 packages/screens/Rakki/styles.ts create mode 100644 packages/screens/Rakki/utils.ts diff --git a/assets/icons/rakki-ticket.svg b/assets/icons/rakki-ticket.svg new file mode 100644 index 0000000000..2f0c53237a --- /dev/null +++ b/assets/icons/rakki-ticket.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/icons/ticket.svg b/assets/icons/ticket.svg new file mode 100644 index 0000000000..f95928c5c4 --- /dev/null +++ b/assets/icons/ticket.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/logos/rakki-ticket.png b/assets/logos/rakki-ticket.png new file mode 100644 index 0000000000000000000000000000000000000000..498e7e67dd58da62bab6e3bb9a68fb92d046c2c2 GIT binary patch literal 252515 zcmdqIRYP1+vn|?9<4$lV5D4z>1P$))4&AuB1q&YB-Q9yja1X8lf_vjGC*MAM?{j~{ zeONYMR;^iM&QVpPR;03`G#WAyG5`QT`zj-$3IM?T1OR|}i17bL#Hw*5{#}q9WprEs z0L-la96*{$e$Ib`Ko?c%FMygUlB0hQuvTIUVgNvW9LkFc900WP@Kr)g-4l5F>QiSo z>O~&r*LAmXkoBDAbB>C@^1D001lYp@;ypPQPAaE{UW*UIs>dg|Pv`#;DPj zHB#~wu9sZXyhERE&1qzyMqPigaE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