Skip to content
Open
16 changes: 10 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: continuous-integration

on: [push, pull_request]
on: [pull_request]

jobs:
CI:
Expand All @@ -18,7 +18,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@master
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
node-version: "${{ steps.nvm.outputs.NVMRC }}"

- name: Check for cached node_modules
uses: actions/cache@v2
Expand All @@ -36,9 +36,13 @@ jobs:
- name: Lint
run: yarn run lint:ci

- name: Build
run: yarn run build
# - name: Build
# run: yarn run build

# TO-DO: Uncomment when tests are ready to be run on CI (such as those in issues #129-#131)
# - name: Test
# run: yarn test:ci
- name: Run App
run: yarn run dev &
sleep 50

- name: Test
run: yarn test
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@taquito/tezbridge-wallet": "13.0.1",
"@taquito/tzip12": "13.0.1",
"@taquito/tzip16": "13.0.1",
"@testing-library/react": "^13.4.0",
"@types/mixpanel-browser": "^2.35.7",
"@types/prismjs": "^1.26.0",
"@types/react-router-hash-link": "^2.4.5",
Expand All @@ -45,6 +46,7 @@
"notistack": "^1.0.3",
"prism-themes": "^1.9.0",
"prismjs": "^1.28.0",
"puppeteer": "^19.4.1",
"react": "^17.0.1",
"react-customizable-progressbar": "^1.0.2",
"react-dom": "^17.0.2",
Expand Down
1 change: 1 addition & 0 deletions src/modules/common/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ export const Navbar: React.FC<{
color="secondary"
variant="contained"
style={{ fontSize: "14px" }}
id="navbar-connect-wallet"
onClick={() => connect()}
>
Connect Wallet
Expand Down
2 changes: 1 addition & 1 deletion src/modules/common/WarningFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const WarningFooter: React.FC<{ text: string }> = ({ text }) => {
<ContainerText align="center">{text}</ContainerText>
</Grid>
<Grid item>
<IconButton onClick={closeButton}>
<IconButton id="warning-close-button" onClick={closeButton}>
<CloseIcon htmlColor="#FFC839" />
</IconButton>
</Grid>
Expand Down
4 changes: 2 additions & 2 deletions src/modules/creator/components/NavigationBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ export const NavigationBar: React.FC<NavigationBarProps> = ({ back, next }) => {
<FooterContainer item xs={12} container isMobile={isMobile}>
<Grid item xs={6}>
{back && (
<BackButton onClick={back.handler}>
<BackButton id="back-button" onClick={back.handler}>
<BackButtonIcon />
<Typography color="secondary">{back.text}</Typography>
</BackButton>
)}
</Grid>
<Grid item xs={6}>
{next && (
<NextButton onClick={next.handler}>
<NextButton id="next-button" onClick={next.handler}>
<Typography color="primary">{next.text}</Typography>
</NextButton>
)}
Expand Down
8 changes: 5 additions & 3 deletions src/modules/creator/steps/DaoSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ const ErrorText = styled(Typography)({
})

const DaoSettingsForm = withRouter(({ submitForm, values, setFieldValue, errors, touched, setFieldTouched }: any) => {
console.log("values: ", values)
const theme = useTheme()
const isMobile = useMediaQuery(theme.breakpoints.down("md"))

Expand All @@ -122,16 +123,17 @@ const DaoSettingsForm = withRouter(({ submitForm, values, setFieldValue, errors,
} = useTokenMetadata(values?.governanceToken?.address, values?.governanceToken?.tokenId)

useEffect(() => {
console.log("tokenMetadata: ", tokenMetadata)
if (tokenMetadata) {
setFieldValue("governanceToken.tokenMetadata", tokenMetadata)
setFieldValue("symbol", tokenMetadata.symbol)
setFieldValue("symbol", tokenMetadata?.symbol)
}

if (error) {
setFieldValue("governanceToken.tokenMetadata", undefined)
setFieldValue("symbol", undefined)
}
}, [error, setFieldValue, tokenMetadata])
}, [tokenMetadata, error, setFieldValue])

const { dispatch } = useContext(CreatorContext)
const match = useRouteMatch()
Expand Down Expand Up @@ -183,7 +185,7 @@ const DaoSettingsForm = withRouter(({ submitForm, values, setFieldValue, errors,
<CustomInputContainer>
<Field
id="outlined-basic"
placeholder="0"
// placeholder="0"
name="governanceToken.tokenId"
component={CustomFormikTextField}
InputProps={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ export const DelegationChangeProposalForm: React.FC<Props> = ({ open, handleClos
</Typography>
</Grid>

<SendButton onClick={methods.handleSubmit(onSubmit as any)} disabled={!dao || !newDelegationAddress}>
<SendButton
id="submit-delegate-proposal"
onClick={methods.handleSubmit(onSubmit as any)}
disabled={!dao || !newDelegationAddress}
>
Submit
</SendButton>
</Content>
Expand Down
10 changes: 8 additions & 2 deletions src/modules/explorer/components/FreezeDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,12 @@ export const FreezeDialog: React.FC<{ freeze: boolean }> = ({ freeze }) => {

return (
<div>
<Button onClick={handleClickOpen} variant="contained" color="secondary">
<Button
onClick={handleClickOpen}
id={freeze ? "deposit-dao" : "withdraw-dao"}
variant="contained"
color="secondary"
>
{freeze ? "Deposit" : "Withdraw"}
</Button>
<CustomDialog open={open} onClose={handleClose} title={freeze ? "DEPOSIT" : "WITHDRAW"}>
Expand Down Expand Up @@ -142,6 +147,7 @@ export const FreezeDialog: React.FC<{ freeze: boolean }> = ({ freeze }) => {
</CustomLabelsContainer>
<ProposalFormInput>
<CustomInput
name="amount-field"
value={amount}
type="number"
placeholder="0"
Expand All @@ -159,7 +165,7 @@ export const FreezeDialog: React.FC<{ freeze: boolean }> = ({ freeze }) => {
</ProposalFormInput>
</Grid>
<Grid item container direction="row" alignItems="center" justifyContent="center">
<Button variant="contained" color={"secondary"} disabled={!amount} onClick={onSubmit}>
<Button id="amount-submit" variant="contained" color={"secondary"} disabled={!amount} onClick={onSubmit}>
Submit
</Button>
</Grid>
Expand Down
10 changes: 8 additions & 2 deletions src/modules/explorer/components/NavigationMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export const NavigationMenu: React.FC<{ disableMobileMenu?: boolean }> = ({ disa
<Container container>
<InnerContainer container>
{pages.map((page, i) => (
<PageItem key={`page-${i}`} isSelected={pathId === page.pathId} item>
<PageItem key={`page-${i}`} id={`page-${page.name}`} isSelected={pathId === page.pathId} item>
<Link to={page.href}>
<PageItemBg isSelected={pathId === page.pathId} container>
<Grid item>
Expand All @@ -233,7 +233,13 @@ export const NavigationMenu: React.FC<{ disableMobileMenu?: boolean }> = ({ disa
) : (
<BottomNavBar>
{pages.map((page, i) => (
<PageItem key={`page-${i}`} isSelected={pathId === page.pathId} container item alignItems="center">
<PageItem
key={`page-${i}`}
id={`page-${page.name}`}
isSelected={pathId === page.pathId}
item
alignItems="center"
>
<Link to={page.href}>
<Grid container alignItems="center" justifyContent="center">
<Grid item>
Expand Down
1 change: 1 addition & 0 deletions src/modules/explorer/components/ProposalForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ export const ProposalFormContainer: React.FC<Props> = ({ open, handleClose, defa
style={{ margin: "10px 0 35px 0" }}
onClick={methods.handleSubmit(onSubmit as any)}
disabled={!dao || !daoHoldings}
id="submit-proposal"
>
Submit
</SendButton>
Expand Down
1 change: 1 addition & 0 deletions src/modules/explorer/components/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ export const Navbar: React.FC<{ disableMobileMenu?: boolean }> = ({ disableMobil
variant="contained"
style={{ fontSize: "14px" }}
onClick={() => connect()}
id="nav-connect-wallet"
>
Connect Wallet
</SmallButton>
Expand Down
1 change: 1 addition & 0 deletions src/modules/explorer/pages/DAO/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export const DAO: React.FC = () => {
size={isExtraSmall ? "small" : "medium"}
onClick={onFlush}
disabled={!executableProposals || !executableProposals.length}
id="home-execute-button"
>
Execute
</SmallButton>
Expand Down
6 changes: 4 additions & 2 deletions src/modules/explorer/pages/DAOList/components/DAOItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,14 @@ export const DAOItem: React.FC<{
const daoType = dao.dao_type.name !== "lambda" ? `V2` : `V3`

return (
<Link underline="none" href={daoHref}>
<Link underline="none" href={daoHref} id={`dao-${dao.id}`}>
<Container container justifyContent="space-between">
<SectionNames>
<Grid>
<SymbolText color="secondary">{dao.symbol.toUpperCase()}</SymbolText>
<NameText color="textPrimary">{dao.name}</NameText>
<NameText color="textPrimary" id="dao-name">
{dao.name}
</NameText>
</Grid>
</SectionNames>
<Grid>
Expand Down
1 change: 1 addition & 0 deletions src/modules/explorer/pages/Registry/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export const Registry: React.FC = () => {
color="secondary"
onClick={() => setUpdateRegistryOpen(true)}
disabled={shouldDisable}
id="new-item"
>
New Item
</MainButton>
Expand Down
2 changes: 2 additions & 0 deletions src/modules/explorer/pages/Treasury/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export const Treasury: React.FC = () => {
color="secondary"
onClick={() => setOpenTransfer(true)}
disabled={shouldDisable}
id="new-transfer"
>
New Transfer
</MainButton>
Expand Down Expand Up @@ -126,6 +127,7 @@ export const Treasury: React.FC = () => {
color="secondary"
onClick={() => setOpenDelegationChange(true)}
disabled={shouldDisable}
id="change-delegate-treasury"
>
Change Delegate
</SmallButton>
Expand Down
1 change: 1 addition & 0 deletions src/services/baseDAODocker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const generateStorageContract = async ({
const url = `${API_URL}/${originatorAddress}/${template}?${Object.keys(args)
.map(key => `${key}=${args[key as keyof GeneratorArgs]}`)
.join("&")}`
console.log("url: ", url)

const response = await fetch(url)

Expand Down
4 changes: 2 additions & 2 deletions src/services/beacon/actions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TezosToolkit } from "@taquito/taquito"
import { TezosToolkit, Wallet } from "@taquito/taquito"
import { BeaconWallet } from "@taquito/beacon-wallet"
import { Network } from "./utils"

Expand All @@ -13,7 +13,7 @@ interface UpdateTezos {
tezos: TezosToolkit
network: Network
account: string
wallet: BeaconWallet | undefined
wallet: BeaconWallet | Wallet | undefined
}
}

Expand Down
19 changes: 15 additions & 4 deletions src/services/beacon/hooks/useTezos.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { useQueryClient } from "react-query"
import { useCallback, useContext } from "react"
import { MichelCodecPacker, TezosToolkit } from "@taquito/taquito"
import { MichelCodecPacker, TezosToolkit, Wallet } from "@taquito/taquito"
import { connectWithBeacon, Network, rpcNodes, TezosActionType } from "services/beacon"
import { TezosContext } from "services/beacon/context"
import { Tzip16Module } from "@taquito/tzip16"
import mixpanel from "mixpanel-browser"
import { BeaconWallet } from "@taquito/beacon-wallet"
import { InMemorySigner } from "@taquito/signer"

type WalletConnectReturn = {
tezos: TezosToolkit
Expand All @@ -25,13 +27,20 @@ export const useTezos = (): WalletConnectReturn => {

const connect = useCallback(
async (newNetwork?: Network) => {
const { wallet } = await connectWithBeacon(newNetwork || network)
// let wallet: BeaconWallet | Wallet | undefined

const newTezos = new TezosToolkit(rpcNodes[newNetwork || network])
newTezos.setPackerProvider(new MichelCodecPacker())
newTezos.addExtension(new Tzip16Module())

newTezos.setProvider({ wallet })
// const beaconWallet = await connectWithBeacon(newNetwork || network)
// wallet = beaconWallet.wallet
// newTezos.setProvider({ wallet })

const signer = await InMemorySigner.fromSecretKey("edsk3QoqBuvdamxouPhin7swCvkQNgq4jP5KZPbwWNnwdZpSpJiEbq")
newTezos.setProvider({ signer })
const wallet = newTezos.wallet

const account = await newTezos.wallet.pkh()

dispatch({
Expand Down Expand Up @@ -59,7 +68,9 @@ export const useTezos = (): WalletConnectReturn => {
throw new Error("No Wallet Connected")
}

await wallet.disconnect()
if (wallet instanceof BeaconWallet) {
await wallet.disconnect()
}

dispatch({
type: TezosActionType.RESET_TEZOS
Expand Down
4 changes: 2 additions & 2 deletions src/services/beacon/reducer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TezosToolkit } from "@taquito/taquito"
import { TezosToolkit, Wallet } from "@taquito/taquito"
import { BeaconWallet } from "@taquito/beacon-wallet"
import { createTezos, getTezosNetwork, Network } from "./utils"
import { TezosAction, TezosActionType } from "services/beacon/actions"
Expand All @@ -7,7 +7,7 @@ export interface TezosState {
network: Network
tezos: TezosToolkit
account: string
wallet: BeaconWallet | undefined
wallet: BeaconWallet | Wallet | undefined
}

const network = getTezosNetwork()
Expand Down
10 changes: 8 additions & 2 deletions src/services/contracts/baseDAO/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export abstract class BaseDAO {
{ params, metadata, tezos, network }: DeployParams
): Promise<ContractAbstraction<Wallet>> => {
const treasuryParams = fromStateToBaseStorage(params)
console.log("params: ", params)

if (!metadata.deployAddress) {
throw new Error("Error deploying treasury DAO: There's not address of metadata")
Expand All @@ -82,18 +83,20 @@ export abstract class BaseDAO {
const account = await tezos.wallet.pkh()

try {
const mathfloor = Math.floor(new Date().getTime() / 1000)
console.log("Making storage contract...")
const currentLevel = await getNetworkHead(network)

console.log("mathfloor", Math.floor(new Date().getTime() / 1000) - mathfloor)
const storageCode = await generateStorageContract({
network,
template,
storage: treasuryParams,
originatorAddress: account,
metadata,
currentLevel
currentLevel: currentLevel + 30
})
console.log("Originating DAO contract...")
console.log("mathfloor", Math.floor(new Date().getTime() / 1000) - mathfloor)

const contractMichaelson = lambdaDAOContractCode

Expand All @@ -105,12 +108,15 @@ export abstract class BaseDAO {
code: contractMichaelson,
init: storageCode
})
console.log("mathfloor", Math.floor(new Date().getTime() / 1000) - mathfloor)

console.log("t: ", t)
const operation = await t.send()
console.log("operation: ", operation)
console.log("Waiting for confirmation on DAO contract...", t)
console.log("mathfloor", Math.floor(new Date().getTime() / 1000) - mathfloor)
const { address } = await operation.contract()
console.log("mathfloor", Math.floor(new Date().getTime() / 1000) - mathfloor)

return await tezos.wallet.at(address)
} catch (e) {
Expand Down
Loading