repo_id
stringclasses
563 values
file_path
stringlengths
40
166
content
stringlengths
1
2.94M
__index_level_0__
int64
0
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/constants/types.ts
export type TransactionDetail = { info: string; isCompleted: boolean; }
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/constants/index.ts
export const DEVNET_API = "https://api.devnet.solana.com" export const processed = "processed" export const BUNDLR_DEVNET = "https://devnet.bundlr.network" export const ARWEAVE_DEVNET = "https://devnet.arweave.net" export const DEFAULT_GRANT_HEADER_IMAGE = "/images/default-grant-image.png"
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/stores/useUserSOLBalanceStore.tsx
import create, { State } from 'zustand' import { Connection, PublicKey, LAMPORTS_PER_SOL } from '@solana/web3.js' interface UserSOLBalanceStore extends State { balance: number; getUserSOLBalance: (publicKey: PublicKey, connection: Connection) => void } const useUserSOLBalanceStore = create<UserSOLBalanceStore>((s...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/stores/useNotificationStore.tsx
import create, { State } from "zustand"; import produce from "immer"; interface NotificationStore extends State { notifications: Array<{ type: string message: string description?: string txid?: string }> set: (x: any) => void } const useNotificationStore = create<NotificationStore>((set, _get) =...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/utils/displayPubKey.ts
import {PublicKey} from "@solana/web3.js"; /** * Converts public key to a string representation and * returns public key in this format `EgG3...rWbXi` */ export default function DisplayPublicKey(publicKey: PublicKey): string { const pubKey = publicKey.toBase58(); return pubKey.slice(0, 4) + '...' + pubKey....
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/utils/copyContent.ts
export default async function copyText(copyValue: string) { navigator.clipboard.writeText(copyValue).then() }
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/utils/uploadToWeb3DB.ts
import { WebBundlr } from "@bundlr-network/client"; import { WalletContextState } from "@solana/wallet-adapter-react"; import { DEVNET_API, BUNDLR_DEVNET } from "../constants"; import { TransactionDetail } from '../constants/types'; export default async function uploadToWeb3DB(wallet: WalletContextState, data: Object,...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/utils/explorer.ts
import { PublicKey, Transaction } from '@solana/web3.js' import base58 from 'bs58' export function getExplorerUrl( endpoint: string, viewTypeOrItemAddress: 'inspector' | PublicKey | string, itemType = 'address' // | 'tx' | 'block' ) { const getClusterUrlParam = () => { let cluster = '' if...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/utils/getProvider.ts
import { AnchorProvider } from "@project-serum/anchor"; import { AnchorWallet } from "@solana/wallet-adapter-react"; import { Connection } from "@solana/web3.js"; import { DEVNET_API, processed } from "../constants"; /** * * @returns provider to the caller. */ export default async function GetProvider(wallet: Ancho...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/utils/notifications.tsx
import useNotificationStore from "../stores/useNotificationStore"; export function notify(newNotification: { type?: string message: string description?: string txid?: string }) { const { notifications, set: setNotificationStore, } = useNotificationStore.getState() setNotificationStore((state: { ...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/utils/conversion.ts
const toBytesInt32 = (num: number): Buffer => { const arr = new ArrayBuffer(4); const view = new DataView(arr); view.setUint32(0, num); return Buffer.from(arr); }; export { toBytesInt32 };
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/utils/sendSol.tsx
import { WalletContextState } from "@solana/wallet-adapter-react"; import { PublicKey, SystemProgram, Transaction, LAMPORTS_PER_SOL } from "@solana/web3.js"; import GetProvider from "./getProvider"; const sendSol = async (wallet: WalletContextState, destPubKeyString: string, solCoinsToBeTransferred: nu...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/utils/index.ts
// Concatenates classes into a single className string export const cn = (...args: string[]) => args.join(' ');
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/utils/fetchDataFromArweave.ts
import { ARWEAVE_DEVNET } from "../constants"; export default async (id: string) => { try { const response = await fetch(`${ARWEAVE_DEVNET}/${id}`); const arrayBuffer = await response.arrayBuffer(); const data = String.fromCharCode.apply(null, new Uint8Array(arrayBuffer)); return { err: false, data: ...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/utils/fetchGithubUserDataFromUserId.ts
export default async (userId: string) => { try { const response = await fetch(`https://api.github.com/user/${userId}`); const data = await response.json(); if (data.message === "Not Found") { return { err: true }; } return { err: false, data }; } catch (error) { return { err: true };...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/models/grant.ts
import {PublicKey} from "@solana/web3.js"; export interface GrantModel { author?: PublicKey, escrowCount?: number, info?: string, lamportsRaised?: number, totalDonors?: number, targetLamports?: number, dueDate?: number, isActive?: boolean, matchingEligible?: boolean, grantNum?: ...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/models/types.ts
export type EndpointTypes = 'mainnet' | 'devnet' | 'localnet'
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/models/programInfo.ts
import {PublicKey} from "@solana/web3.js"; export interface ProgramInfoModel { bump?: number, grantsCount?: number, admin?: PublicKey, }
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/styles/globals.css
/* Grants Logo */ @import url('https://fonts.googleapis.com/css2?family=Quantico&display=swap'); /* norma text */ @import url('https://fonts.googleapis.com/css2?family=Montserrat&display=swap'); @tailwind base; @tailwind components; @tailwind utilities; html, body { padding: 0; margin: 0; font-family: -apple-s...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/components/ContentContainer.tsx
import { FC } from 'react'; import Link from "next/link"; export const ContentContainer: FC = props => { return ( <div className="flex-1 drawer h-52"> {/* <div className="h-screen drawer drawer-mobile w-full"> */} <input id="my-drawer" type="checkbox" className="grow drawer-toggle" /> <div class...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/components/ExplorerCard.tsx
import { contrastColor } from "contrast-color"; import { BN } from "@project-serum/anchor"; import { LAMPORTS_PER_SOL } from "@solana/web3.js"; import { useRouter } from "next/router"; export interface ExplorerCardProps { imageLink: string; title: string; author: BN | string; authorLink: string; description:...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/components/TransactionSeries.tsx
import React from 'react'; import { TransactionDetail } from "../constants/types" type Props = { transactionsList: Array<TransactionDetail> } export default function TransactionSeries({ transactionsList }: Props) { return ( <> <div> {transactionsList.length > 0 && transactionsList.map((transacti...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/components/DonateSol.tsx
import { BN, AnchorError } from "@project-serum/anchor"; import { Connection, LAMPORTS_PER_SOL } from "@solana/web3.js"; import { processed, DEVNET_API } from "../constants"; import React, { useState } from "react"; import { makeDonation } from "transactions"; import { notify } from "../utils/notifications"; import { D...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/components/AppBar.tsx
import {FC, useState} from 'react'; import {WalletMultiButton} from "@solana/wallet-adapter-react-ui"; import Link from "next/link"; import {useSession, signIn, signOut} from 'next-auth/react'; import ProfileMenu from "./common/profile-menu"; export const AppBar: FC = props => { const [isOpen, setIsOpen] = useStat...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/components/markdownConvert.tsx
import React, {Component} from 'react'; import {marked} from 'marked'; type InputProps = { hide?: boolean; value: string; handleChange: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void; readOnly: boolean; } type InputState = { value: string } /********* Input component **...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/components/ExploreCard.tsx
import { useState } from "react"; import { contrastColor } from "contrast-color"; import { BN } from "@project-serum/anchor"; import { LAMPORTS_PER_SOL } from "@solana/web3.js"; import { useRouter } from "next/router"; import { DEFAULT_GRANT_HEADER_IMAGE } from "../constants"; export interface ExploreCardProps { ima...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/components/SendTransaction.tsx
import { useConnection, useWallet } from '@solana/wallet-adapter-react'; import { Keypair, SystemProgram, Transaction, TransactionSignature } from '@solana/web3.js'; import { FC, useCallback } from 'react'; import { notify } from "../utils/notifications"; export const SendTransaction: FC = () => { const { connecti...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/components/WalletConnection.tsx
export default function WalletConnection() { return ( <> <div className='absolute w-48 h-33 bg-[#FFB413] ml-56 mt-8 p-3 btn btn-ghost bg-yellow-500 hover:bg-yellow-600 px-7 rounded-md' > <button className="absolute font-extrabold" ><h1>Connect Wallet</h1></button> </div> ...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/components/Notification.tsx
import { useEffect, useState } from 'react' import { CheckCircleIcon, InformationCircleIcon, XCircleIcon, } from '@heroicons/react/outline' import { XIcon } from '@heroicons/react/solid' import useNotificationStore from '../stores/useNotificationStore' import { useConnection } from '@solana/wallet-adapter-react';...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/components/grant_stats.tsx
import React from 'react'; import {Provider} from "@project-serum/anchor"; import CountUp from 'react-countup'; import VisibilitySensor from 'react-visibility-sensor'; let grantStats = [ { id: '1', text: 'Grants Created', number: 169, }, { id: '2', text: 'Grants Matched'...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/components/Modal.tsx
import React from "react"; type ModalProps = { setpreview: (preview: boolean) => void; classNameForModalBoxStyling?: string; showCloseButton: boolean; children: any; id: string; }; export default function Modal({ setpreview, classNameForModalBoxStyling, showCloseButton, id, children, }: ModalProps...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/components/SignMessage.tsx
// TODO: SignMessage import { useWallet } from '@solana/wallet-adapter-react'; import bs58 from 'bs58'; import { FC, useCallback } from 'react'; import { sign } from 'tweetnacl'; import { notify } from "../utils/notifications"; export const SignMessage: FC = () => { const { publicKey, signMessage } = useWallet(); ...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/components/Toast.tsx
import { ToastContainer, toast } from "react-toastify"; import "react-toastify/dist/ReactToastify.css"; const Toast = () => { return ( <ToastContainer position="bottom-left" autoClose={2500} hideProgressBar={false} newestOnTop={false} closeOnClick rtl={false} pauseOnFocu...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/components/RequestAirdrop.tsx
import { useConnection, useWallet } from '@solana/wallet-adapter-react'; import { LAMPORTS_PER_SOL, TransactionSignature } from '@solana/web3.js'; import { FC, useCallback } from 'react'; import { notify } from "../utils/notifications"; import useUserSOLBalanceStore from '../stores/useUserSOLBalanceStore'; export cons...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/components/DonationChart.tsx
import { FC } from "react"; import { Chart as ChartJS, CategoryScale, LinearScale, PointElement, LineElement, Title, Filler, Legend, } from "chart.js"; import { Line } from "react-chartjs-2"; ChartJS.register( CategoryScale, LinearScale, PointElement, LineElement, Title, Filler, Legend );...
0
solana_public_repos/solana-grants/app/src/components
solana_public_repos/solana-grants/app/src/components/common/profile-menu.tsx
import {MdContentCopy, MdDone, MdLogout} from 'react-icons/md'; import {TbBrandGithub, TbUser, TbWallet, TbWalletOff} from 'react-icons/tb'; import React, {useRef, useState} from 'react'; import Card from '../common/card'; import Text from '../common/text'; import Button from '../common/button'; import {signIn, signOut...
0
solana_public_repos/solana-grants/app/src/components
solana_public_repos/solana-grants/app/src/components/common/card.tsx
import React from 'react'; import { cn } from '../../utils/'; /** * Properties for a card component. */ type CardProps = { className?: string; children?: React.ReactNode; tabIndex?: number; blur?: boolean; border?: boolean; }; /** * Definition of a card component,the main purpose of * which is...
0
solana_public_repos/solana-grants/app/src/components
solana_public_repos/solana-grants/app/src/components/common/footer.tsx
import { FC, useState } from "react"; export const Footer: FC = () => { const [showDropdown, setshowDropdown] = useState(false); const onClickDropdown = () => { if (showDropdown === true) { setshowDropdown(false); } else { setshowDropdown(true); } }; return ( <footer className...
0
solana_public_repos/solana-grants/app/src/components
solana_public_repos/solana-grants/app/src/components/common/custom-wallet-multi-button.tsx
import React from 'react'; import Text from '../common/text'; import {cn} from 'utils'; import {IconType} from 'react-icons'; import {WalletDisconnectButton, WalletMultiButton} from "@solana/wallet-adapter-react-ui"; /** * props for a button component. */ type ButtonProps = { className?: string; onClick?: ()...
0
solana_public_repos/solana-grants/app/src/components
solana_public_repos/solana-grants/app/src/components/common/button.tsx
import React from 'react'; import Text from '../common/text'; import {cn} from 'utils'; import {IconType} from 'react-icons'; /** * props for a button component. */ type ButtonProps = { className?: string; onClick?: () => void; variant?: | 'transparent' text?: string; textColorVariant?: ...
0
solana_public_repos/solana-grants/app/src/components
solana_public_repos/solana-grants/app/src/components/common/text.tsx
import React from 'react'; import Link from 'next/link'; import {cn} from 'utils'; /** * Properties for a card component. */ type TextProps = { variant: | 'hero' | 'big-heading' | 'heading' | 'sub-heading' | 'nav-heading' | 'nav' | 'paragraph' | 'us...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/transactions/cancelGrant.ts
import * as anchor from "@project-serum/anchor"; import { encode } from "@project-serum/anchor/dist/cjs/utils/bytes/utf8"; import { PublicKey, Transaction, } from "@solana/web3.js"; import { toBytesInt32 } from "../utils/conversion"; import { Program } from "@project-serum/anchor"; import { GrantsProgram } from ".....
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/transactions/makeDonation.ts
import * as anchor from "@project-serum/anchor"; import { BN, Program } from "@project-serum/anchor"; import { encode } from "@project-serum/anchor/dist/cjs/utils/bytes/utf8"; import { PublicKey } from "@solana/web3.js"; import { toBytesInt32 } from "../utils/conversion"; import { GrantsProgram } from "../idl/grants_pr...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/transactions/index.ts
export { makeDonation } from "./makeDonation"; export { cancelGrant, refundDonations } from "./cancelGrant";
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/hooks/useQueryContext.tsx
import { useRouter } from 'next/router' import { EndpointTypes } from '../models/types' export default function useQueryContext() { const router = useRouter() const { cluster } = router.query const endpoint = cluster ? (cluster as EndpointTypes) : 'mainnet' const hasClusterOption = endpoint !== 'mainnet' co...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/views/index.tsx
export { GrantCreationView } from './create-grant'; export { ExplorerView } from "./explore"; export { LandingPageView } from "./landing-page";
0
solana_public_repos/solana-grants/app/src/views
solana_public_repos/solana-grants/app/src/views/create-grant/index.tsx
import { FC, useState } from 'react'; import uploadToWeb3DB from '../../utils/uploadToWeb3DB'; import { LAMPORTS_PER_SOL } from "@solana/web3.js"; import GetProvider from '../../utils/getProvider'; import { useWallet } from '@solana/wallet-adapter-react'; import { TransactionDetail } from '../../constants/types'; impor...
0
solana_public_repos/solana-grants/app/src/views
solana_public_repos/solana-grants/app/src/views/explore/index.tsx
import { FC, useEffect, useRef, useState } from "react"; import personImage from "../../../public/images/person-opens-the-safe-with-the-money.png"; import { ExploreCard, ExploreCardProps } from "../../components/ExploreCard"; import getGrants from "instructions/getGrants"; import { useWallet } from '@solana/wallet-adap...
0
solana_public_repos/solana-grants/app/src/views
solana_public_repos/solana-grants/app/src/views/landing-page/index.tsx
import { FC } from 'react'; import { useRouter } from "next/router"; import GrantStats from "../../components/grant_stats"; import {useWallet} from "@solana/wallet-adapter-react"; export const LandingPageView: FC = ({ }) => { const router = useRouter(); const navigateToCreateGrantPage = () => { router.push("/...
0
solana_public_repos/solana-grants/app/src/views
solana_public_repos/solana-grants/app/src/views/grant/index.tsx
import { FC, useEffect, useState } from "react"; import Markdown from "marked-react"; import { Path } from "progressbar.js"; import CountUp from "react-countup"; import fetchGithubUserDataFromUserId from "utils/fetchGithubUserDataFromUserId"; import Error from "next/error"; import { CopyToClipboard } from "react-copy-t...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/pages/index.tsx
import React, { useState } from 'react'; import type { NextPage } from "next"; import Head from "next/head"; import { LandingPageView } from "../views"; const LandingPage: NextPage = (props) => { return ( <div> <Head> <title>Solana Grants</title> <meta name="description" ...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/pages/_document.tsx
import Document, { DocumentContext, Head, Html, Main, NextScript } from 'next/document' class MyDocument extends Document { static async getInitialProps(ctx: DocumentContext) { const initialProps = await Document.getInitialProps(ctx) return initialProps } render() { return ( <Html> <H...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/pages/explore.tsx
import type { NextPage } from "next"; import Head from "next/head"; import { ExplorerView } from "views"; const Explore: NextPage = (props) => { return ( <div> <Head> <title>Explore Grants</title> <meta name='description' content='Explore Grants' /> </Head> <ExplorerView /> ...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/pages/_app.tsx
import { AppProps } from "next/app"; import { FC } from "react"; import { SessionProvider } from "next-auth/react"; import { ContextProvider } from "../contexts/ContextProvider"; import { AppBar } from "../components/AppBar"; import { Footer } from "../components/common/footer"; import Notifications from "../components...
0
solana_public_repos/solana-grants/app/src
solana_public_repos/solana-grants/app/src/pages/create-grant.tsx
import type { NextPage } from "next"; import Head from "next/head"; import { GrantCreationView } from "views"; const GrantCreationFlow: NextPage = (props) => { return ( <div> <Head> <title>Grants Explorer</title> <meta name='description' content='Grants Explorer'...
0
solana_public_repos/solana-grants/app/src/pages
solana_public_repos/solana-grants/app/src/pages/api/hello.ts
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction import type { NextApiRequest, NextApiResponse } from 'next' type Data = { name: string } export default function handler( req: NextApiRequest, res: NextApiResponse<Data> ) { res.status(200).json({ name: 'John Doe' }) }
0
solana_public_repos/solana-grants/app/src/pages/api
solana_public_repos/solana-grants/app/src/pages/api/auth/[...nextauth].ts
import NextAuth from 'next-auth' import GithubProvider from "next-auth/providers/github" export default NextAuth({ providers: [ GithubProvider({ clientId: process.env.GITHUB_ID, clientSecret: process.env.GITHUB_SECRET, }), ], callbacks: { session: async ({ session, token }...
0
solana_public_repos/solana-grants/app/src/pages
solana_public_repos/solana-grants/app/src/pages/grant/[id].tsx
import getProvider from "instructions/api/getProvider"; import getGrant from "instructions/getGrant"; import getProgramInfo from "instructions/getProgramInfo"; import { Keypair } from "@solana/web3.js"; import { loremIpsum } from "lorem-ipsum"; import type { GetStaticPaths, GetStaticProps, InferGetStaticPropsType...
0
solana_public_repos/solana-grants
solana_public_repos/solana-grants/tests/grants-program.ts
import * as anchor from "@project-serum/anchor"; import { BN, Program } from "@project-serum/anchor"; import { encode } from "@project-serum/anchor/dist/cjs/utils/bytes/utf8"; import { Keypair, LAMPORTS_PER_SOL, PublicKey, SystemProgram, Transaction, } from "@solana/web3.js"; import { expect } from "chai"; im...
0
solana_public_repos/solana-grants/tests
solana_public_repos/solana-grants/tests/suites/donations.test.ts
import * as anchor from "@project-serum/anchor"; import { AnchorError, BN, Program } from "@project-serum/anchor"; import { encode } from "@project-serum/anchor/dist/cjs/utils/bytes/utf8"; import { Keypair, LAMPORTS_PER_SOL, PublicKey, SendTransactionError, } from "@solana/web3.js"; import { assert, expect } fr...
0
solana_public_repos/solana-grants/tests
solana_public_repos/solana-grants/tests/suites/grants.test.ts
import * as anchor from "@project-serum/anchor"; import {AnchorError, BN, Program} from "@project-serum/anchor"; import {GrantsProgram} from "../../target/types/grants_program"; import {LAMPORTS_PER_SOL, PublicKey, Keypair} from "@solana/web3.js"; import {encode} from "@project-serum/anchor/dist/cjs/utils/bytes/utf8"; ...
0
solana_public_repos/solana-grants/tests
solana_public_repos/solana-grants/tests/suites/matches.test.ts
import * as anchor from "@project-serum/anchor"; import { AnchorError, BN, Program, Provider } from "@project-serum/anchor"; import { encode } from "@project-serum/anchor/dist/cjs/utils/bytes/utf8"; import { Keypair, LAMPORTS_PER_SOL, PublicKey, SendTransactionError, SystemProgram, Transaction, } from "@sol...
0
solana_public_repos/solana-grants/programs
solana_public_repos/solana-grants/programs/grants-program/Cargo.toml
[package] name = "grants-program" version = "0.1.0" description = "Created with Anchor" edition = "2021" [lib] crate-type = ["cdylib", "lib"] name = "grants_program" [features] no-entrypoint = [] no-idl = [] no-log-ix-name = [] cpi = ["no-entrypoint"] default = [] [profile.release] overflow-checks = true [dependenc...
0
solana_public_repos/solana-grants/programs
solana_public_repos/solana-grants/programs/grants-program/Xargo.toml
[target.bpfel-unknown-unknown.dependencies.std] features = []
0
solana_public_repos/solana-grants/programs/grants-program
solana_public_repos/solana-grants/programs/grants-program/src/lib.rs
//! This library has all the logic for the smart contract of Solana Grants. use anchor_lang::prelude::*; use instructions::*; pub mod state; mod instructions; mod errors; declare_id!("8Gz5WWV7T2w8gBBVa4bcsmXqGETjhoBwKN5gLhgXkAQf"); /// Main program entrypoint #[program] pub mod grants_program { #![warn(missing...
0
solana_public_repos/solana-grants/programs/grants-program/src
solana_public_repos/solana-grants/programs/grants-program/src/instructions/eligible_matching.rs
use crate::state::{Grant, ProgramInfo}; use anchor_lang::prelude::*; /// This instruction lets an admin make a grant eligible for matching. #[derive(Accounts)] pub struct EligibleMatching<'info> { admin: Signer<'info>, #[account( mut, seeds = [b"grant", grant.grant_num.to_be_bytes().as_ref()],...
0
solana_public_repos/solana-grants/programs/grants-program/src
solana_public_repos/solana-grants/programs/grants-program/src/instructions/release_grant.rs
use anchor_lang::{prelude::*, solana_program::sysvar::rent}; use crate::{state::{ProgramInfo, Grant, FundingState}, errors::GrantError}; #[derive(Accounts)] pub struct ReleaseGrant<'info> { admin: Signer<'info>, #[account( has_one = admin, seeds = [ProgramInfo::SEED.as_bytes().as_ref()], ...
0
solana_public_repos/solana-grants/programs/grants-program/src
solana_public_repos/solana-grants/programs/grants-program/src/instructions/create_grant.rs
use crate::{ errors::GrantError, state::{Grant, ProgramInfo, Donation}, }; use anchor_lang::prelude::*; #[derive(Accounts)] pub struct CreateGrant<'info> { #[account(mut)] author: Signer<'info>, #[account( init, payer = author, seeds = [b"grant", program_info.grants_count.t...
0
solana_public_repos/solana-grants/programs/grants-program/src
solana_public_repos/solana-grants/programs/grants-program/src/instructions/initialize_program_info.rs
use anchor_lang::prelude::*; use crate::state::{ProgramInfo}; #[derive(Accounts)] pub struct Initialize<'info> { #[account(mut)] admin: Signer<'info>, #[account( init, payer = admin, seeds = [ProgramInfo::SEED.as_bytes().as_ref()], bump, space = 8 + ProgramInfo...
0
solana_public_repos/solana-grants/programs/grants-program/src
solana_public_repos/solana-grants/programs/grants-program/src/instructions/increment_donation.rs
use anchor_lang::{prelude::*, solana_program::{program::invoke, system_instruction}}; use crate::{state::{Donation, Grant, ProgramInfo}, errors::DonationError}; #[derive(Accounts)] pub struct IncrementDonation<'info> { #[account( mut, has_one = payer, has_one = grant, seeds = [ ...
0
solana_public_repos/solana-grants/programs/grants-program/src
solana_public_repos/solana-grants/programs/grants-program/src/instructions/mod.rs
mod initialize_program_info; mod create_grant; mod create_donation; mod release_grant; mod cancel_donation; mod increment_donation; mod cancel_grant_admin; mod cancel_grant_author; mod eligible_matching; pub use initialize_program_info::*; pub use create_grant::*; pub use create_donation::*; pub use release_grant::*; ...
0
solana_public_repos/solana-grants/programs/grants-program/src
solana_public_repos/solana-grants/programs/grants-program/src/instructions/create_donation.rs
use crate::errors::DonationError; use crate::state::Donation; use crate::state::Grant; use crate::state::Link; use crate::state::ProgramInfo; use anchor_lang::prelude::*; use anchor_lang::solana_program::program::invoke; use anchor_lang::solana_program::system_instruction; #[derive(Accounts)] pub struct CreateDonation...
0
solana_public_repos/solana-grants/programs/grants-program/src
solana_public_repos/solana-grants/programs/grants-program/src/instructions/cancel_grant_admin.rs
use crate::state::{Grant, ProgramInfo}; use anchor_lang::prelude::*; /// Lets an admin cancel a grant. #[derive(Accounts)] pub struct CancelGrantAdmin<'info> { admin: Signer<'info>, #[account( mut, seeds = [b"grant", grant.grant_num.to_be_bytes().as_ref()], bump = grant.bump, )] ...
0
solana_public_repos/solana-grants/programs/grants-program/src
solana_public_repos/solana-grants/programs/grants-program/src/instructions/cancel_donation.rs
use anchor_lang::prelude::*; use crate::{ errors::{DonationError, GrantError}, state::{Donation, DonationState, FundingState, Grant, ProgramInfo}, }; #[derive(Accounts)] pub struct CancelDonation<'info> { admin: Signer<'info>, #[account(has_one = admin, seeds = [ProgramInfo::SEED.as_bytes().as_ref()]...
0
solana_public_repos/solana-grants/programs/grants-program/src
solana_public_repos/solana-grants/programs/grants-program/src/instructions/cancel_grant_author.rs
use crate::state::Grant; use anchor_lang::prelude::*; /// Lets an author cancel a grant. #[derive(Accounts)] pub struct CancelGrantAuthor<'info> { author: Signer<'info>, #[account( mut, seeds = [b"grant", grant.grant_num.to_be_bytes().as_ref()], bump = grant.bump, has_one = aut...
0
solana_public_repos/solana-grants/programs/grants-program/src
solana_public_repos/solana-grants/programs/grants-program/src/state/link.rs
use anchor_lang::prelude::*; /// This is just a linking account intended to be used as a PDA for /// when a different seed is needed to reach another account. #[account] pub struct Link { pub bump: u8, // 1 pub address: Pubkey, // 32 } impl Link { pub const MAXIMUM_SPACE: usize = 1 + 32; p...
0
solana_public_repos/solana-grants/programs/grants-program/src
solana_public_repos/solana-grants/programs/grants-program/src/state/mod.rs
mod donation; mod grant; mod link; mod program_info; pub use donation::*; pub use grant::*; pub use link::*; pub use program_info::*;
0
solana_public_repos/solana-grants/programs/grants-program/src
solana_public_repos/solana-grants/programs/grants-program/src/state/donation.rs
use anchor_lang::prelude::*; /// This account will keep track of the money given to a grant, which can be /// either a user donation or a match. This will not hold the money. #[account] pub struct Donation { pub payer: Pubkey, // 32 pub grant: Pubkey, // 32 pub amount: u64, // ...
0
solana_public_repos/solana-grants/programs/grants-program/src
solana_public_repos/solana-grants/programs/grants-program/src/state/program_info.rs
use anchor_lang::prelude::*; /// This account holds the information of number of grants and admin #[account] #[derive(Default)] pub struct ProgramInfo { pub bump: u8, // 1 pub grants_count: u32, // 8 pub admin: Pubkey, // 32 } impl ProgramInfo { pub const MAXIMUM_SPACE: usize = 1 + 8 ...
0
solana_public_repos/solana-grants/programs/grants-program/src
solana_public_repos/solana-grants/programs/grants-program/src/state/grant.rs
use crate::errors::GrantError; use anchor_lang::prelude::*; use super::Donation; /// This account holds the information for a grant account #[account] #[derive(Default)] pub struct Grant { pub bump: u8, // 1 pub author: Pubkey, // 32 info: String, // 4 +...
0
solana_public_repos/solana-grants/programs/grants-program/src
solana_public_repos/solana-grants/programs/grants-program/src/errors/grant_error.rs
use anchor_lang::prelude::*; #[error_code] pub enum GrantError { #[msg("The provided info string should be 200 characters long maximum.")] InfoTooLong, #[msg("This grant has already transferred the funds to the receiver")] ReleasedGrant, #[msg("This grant has already been cancelled")] Cancell...
0
solana_public_repos/solana-grants/programs/grants-program/src
solana_public_repos/solana-grants/programs/grants-program/src/errors/mod.rs
mod grant_error; mod donation_error; pub use grant_error::*; pub use donation_error::*;
0
solana_public_repos/solana-grants/programs/grants-program/src
solana_public_repos/solana-grants/programs/grants-program/src/errors/donation_error.rs
use anchor_lang::prelude::*; #[error_code] pub enum DonationError { #[msg("This donation has already refunded the payer")] CancelledDonation, #[msg("The grant related to this donation is not eligible for matching")] NotMatchingEligible, #[msg("The matching account does not have to sufficient...
0
solana_public_repos/openbook-dex
solana_public_repos/openbook-dex/openbook-v2/Cargo.toml
[workspace] members = [ "lib/client", "programs/*", ] [workspace.dependencies] anchor-client = "0.29.0" anchor-lang = "0.29.0" anchor-spl = "0.29.0" fixed = { git = "https://github.com/blockworks-foundation/fixed.git", branch = "v1.11.0-borsh0_10-mango" } pyth-sdk-solana = "0.10.1" solana-account-decoder = "~1.17....
0
solana_public_repos/openbook-dex
solana_public_repos/openbook-dex/openbook-v2/tsconfig.types.json
{ "extends": "./tsconfig", "compilerOptions": { "noEmit": false, "outDir": "./dist/types", "declaration": true, "declarationMap": true, "emitDeclarationOnly": true } }
0
solana_public_repos/openbook-dex
solana_public_repos/openbook-dex/openbook-v2/idl-fixup.sh
#!/bin/bash # Anchor works purely on a token level and does not know that the index types # are just type aliases for a primitive type. This hack replaces them with the # primitive in the idl json and types ts file. TYPES_TO_REPLACE=( "MarketIndex" "NodeHandle" "usize" ) pairs=() for type in ${TYPES_TO_REPLACE[...
0
solana_public_repos/openbook-dex
solana_public_repos/openbook-dex/openbook-v2/LICENSE
The following licenses apply to the contents of this repository: All files in the programs/openbook-v2/src/instructions directory and below are licensed under the GNU General Public License v3.0. See programs/openbook-v2/src/instructions/LICENSE. The contents of the 3rdparty/ directory and below are covered by the li...
0
solana_public_repos/openbook-dex
solana_public_repos/openbook-dex/openbook-v2/justfile
fuzz-toolchain := if `arch` == "arm64" { "+nightly-2023-04-01-x86_64-apple-darwin" } else { "+nightly-2023-04-01" } build: cargo build-sbf --features enable-gpl lint: cargo clippy --no-deps --tests --features enable-gpl --features test-bpf -- --allow=clippy::result-large-err test TEST_NAME: cargo test-sb...
0
solana_public_repos/openbook-dex
solana_public_repos/openbook-dex/openbook-v2/Cargo.lock
# This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 [[package]] name = "Inflector" version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" dependencies = [ "lazy...
0
solana_public_repos/openbook-dex
solana_public_repos/openbook-dex/openbook-v2/.prettierignore
.anchor .DS_Store target node_modules dist build test-ledger
0
solana_public_repos/openbook-dex
solana_public_repos/openbook-dex/openbook-v2/Anchor.toml
[features] seeds = false skip-lint = false [programs.localnet] openbook_v2 = "opnbkNkqux64GppQhwbyEVc3axhssFhVYuwar8rDHCu" [registry] url = "https://api.apr.dev" [provider] cluster = "Localnet" wallet = "~/.config/solana/id.json" [scripts] test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
0
solana_public_repos/openbook-dex
solana_public_repos/openbook-dex/openbook-v2/yarn.lock
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 "@aashutoshrathi/word-wrap@^1.2.3": version "1.2.6" resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A...
0
solana_public_repos/openbook-dex
solana_public_repos/openbook-dex/openbook-v2/tsconfig.esm.json
{ "extends": "./tsconfig", "compilerOptions": { "declaration": false, "declarationMap": false, "module": "esnext", "outDir": "dist/esm", "sourceMap": false } }
0
solana_public_repos/openbook-dex
solana_public_repos/openbook-dex/openbook-v2/package.json
{ "name": "@openbook-dex/openbook-v2", "version": "0.2.10", "description": "Typescript Client for openbook-v2 program.", "repository": "https://github.com/openbook-dex/openbook-v2/", "author": { "name": "OpenBook contributors", "email": "hello@openbook.xxx", "url": "https://github.com/openbook-dex...
0
solana_public_repos/openbook-dex
solana_public_repos/openbook-dex/openbook-v2/tsconfig.cjs.json
{ "extends": "./tsconfig", "compilerOptions": { "declaration": true, "declarationMap": false, "module": "commonjs", "outDir": "dist/cjs", "sourceMap": false }, "include": [ "ts/client/src", "ts/client/scripts", "ts/client/scripts/mm", "ts/client/scripts/keeper" ] }
0
solana_public_repos/openbook-dex
solana_public_repos/openbook-dex/openbook-v2/tsconfig.json
{ "compilerOptions": { "esModuleInterop": true, "module": "esnext", "moduleResolution": "node", "noEmit": true, "noImplicitAny": false, "resolveJsonModule": true, "skipLibCheck": true, "strictNullChecks": true, "target": "esnext", }, "ts-node": { // these options are overri...
0
solana_public_repos/openbook-dex
solana_public_repos/openbook-dex/openbook-v2/rust-toolchain.toml
[toolchain] channel = "1.70.0"
0
solana_public_repos/openbook-dex
solana_public_repos/openbook-dex/openbook-v2/.eslintrc.json
{ "env": { "browser": true, "es2021": true, "node": true }, "extends": [ "eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier" ], "parser": "@typescript-eslint/parser", "parserOptions": { "ecmaVersion": "latest", "sourceType": "module" }, "plugins": [ ...
0
solana_public_repos/openbook-dex/openbook-v2
solana_public_repos/openbook-dex/openbook-v2/idl/openbook_v2.json
{ "version": "0.1.0", "name": "openbook_v2", "instructions": [ { "name": "createMarket", "docs": [ "Create a [`Market`](crate::state::Market) for a given token pair." ], "accounts": [ { "name": "market", "isMut": true, "isSigner": true ...
0
solana_public_repos/openbook-dex/openbook-v2
solana_public_repos/openbook-dex/openbook-v2/migrations/deploy.ts
// Migrations are an early feature. Currently, they're nothing more than this // single deploy script that's invoked from the CLI, injecting a provider // configured from the workspace's Anchor.toml. const anchor = require('@coral-xyz/anchor'); module.exports = async function (provider) { // Configure client to use...
0