Compare commits
No commits in common. "43620736cf258df987aaf2aa7ad7d90b987a10a6" and "98a6a5b5d291c112d7d1b5b2302b51a67f47efd4" have entirely different histories.
43620736cf
...
98a6a5b5d2
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ghost-dao-interface",
|
"name": "ghost-dao-interface",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.5.35",
|
"version": "0.5.33",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@ -200,41 +200,21 @@ const NewProposal = ({ config, address, connect, chainId }) => {
|
|||||||
</Box>
|
</Box>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{isSmallScreen
|
<TableContainer>
|
||||||
? <Box display="flex" flexDirection="column">
|
<Table aria-label="Available bonds" style={{ tableLayout: "fixed" }}>
|
||||||
{proposalFunctions?.map((metadata, index) => {
|
<TableHead>
|
||||||
return parseFunctionCalldata({
|
<TableRow>
|
||||||
metadata,
|
<TableCell align="center" style={{ padding: "8px 0" }}>Function</TableCell>
|
||||||
index,
|
<TableCell align="center" style={{ padding: "8px 0" }}>Target</TableCell>
|
||||||
chainId,
|
<TableCell align="center" style={{ padding: "8px 0" }}>Calldata</TableCell>
|
||||||
removeCalldata,
|
<TableCell align="center" style={{ padding: "8px 0" }}>Value</TableCell>
|
||||||
nativeCoin: nativeCurrency,
|
</TableRow>
|
||||||
isTable: false,
|
</TableHead>
|
||||||
});
|
<TableBody>{proposalFunctions.map((metadata, index) => {
|
||||||
})}
|
return parseFunctionCalldata(metadata, index, chainId, nativeCurrency, removeCalldata);
|
||||||
</Box>
|
})}</TableBody>
|
||||||
: <TableContainer>
|
</Table>
|
||||||
<Table aria-label="Available bonds" style={{ tableLayout: "fixed" }}>
|
</TableContainer>
|
||||||
<TableHead>
|
|
||||||
<TableRow>
|
|
||||||
<TableCell align="center" style={{ padding: "8px 0" }}>Function</TableCell>
|
|
||||||
<TableCell align="center" style={{ padding: "8px 0" }}>Target</TableCell>
|
|
||||||
<TableCell align="center" style={{ padding: "8px 0" }}>Calldata</TableCell>
|
|
||||||
<TableCell align="center" style={{ padding: "8px 0" }}>Value</TableCell>
|
|
||||||
</TableRow>
|
|
||||||
</TableHead>
|
|
||||||
<TableBody>{proposalFunctions?.map((metadata, index) => {
|
|
||||||
return parseFunctionCalldata({
|
|
||||||
metadata,
|
|
||||||
index,
|
|
||||||
chainId,
|
|
||||||
removeCalldata,
|
|
||||||
nativeCoin: nativeCurrency,
|
|
||||||
});
|
|
||||||
})}</TableBody>
|
|
||||||
</Table>
|
|
||||||
</TableContainer>
|
|
||||||
}
|
|
||||||
</Paper>}
|
</Paper>}
|
||||||
</Box>
|
</Box>
|
||||||
</Container>
|
</Container>
|
||||||
|
|||||||
@ -216,20 +216,15 @@ const ProposalDetails = ({ chainId, address, connect, config }) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box sx={{ mt: "15px" }}>
|
<Box sx={{ mt: "15px" }}>
|
||||||
<Box
|
<Box display="flex" justifyContent="space-between" gap="20px">
|
||||||
gap="20px"
|
|
||||||
display="flex"
|
|
||||||
justifyContent={"space-between"}
|
|
||||||
flexDirection={isSmallScreen ? "column" : "row"}
|
|
||||||
>
|
|
||||||
<Paper
|
<Paper
|
||||||
fullWidth
|
fullWidth
|
||||||
enableBackground
|
enableBackground
|
||||||
headerContent={
|
headerContent={
|
||||||
<Box display="flex" alignItems="center" flexDirection="row" gap="10px">
|
<Box display="flex" alignItems="center" flexDirection="row" gap="10px">
|
||||||
{!isSmallScreen &&<Typography variant="h6">
|
<Typography variant="h6">
|
||||||
Progress
|
Progress
|
||||||
</Typography>}
|
</Typography>
|
||||||
<Chip
|
<Chip
|
||||||
sx={{ marginTop: "4px", width: "88px" }}
|
sx={{ marginTop: "4px", width: "88px" }}
|
||||||
label={convertStatusToLabel(proposalState)}
|
label={convertStatusToLabel(proposalState)}
|
||||||
@ -311,14 +306,14 @@ const ProposalDetails = ({ chainId, address, connect, config }) => {
|
|||||||
disabled={proposalState !== 1 || pastVotes?._value === 0n || isPending}
|
disabled={proposalState !== 1 || pastVotes?._value === 0n || isPending}
|
||||||
onClick={() => handleVote(1)}
|
onClick={() => handleVote(1)}
|
||||||
>
|
>
|
||||||
{isPending ? "Voting..." : "For"}
|
For
|
||||||
</SecondaryButton>
|
</SecondaryButton>
|
||||||
<SecondaryButton
|
<SecondaryButton
|
||||||
fullWidth
|
fullWidth
|
||||||
disabled={proposalState !== 1 || pastVotes?._value === 0n || isPending}
|
disabled={proposalState !== 1 || pastVotes?._value === 0n || isPending}
|
||||||
onClick={() => handleVote(0)}
|
onClick={() => handleVote(0)}
|
||||||
>
|
>
|
||||||
{isPending ? "Voting..." : "Against"}
|
Against
|
||||||
</SecondaryButton>
|
</SecondaryButton>
|
||||||
</>
|
</>
|
||||||
: <SecondaryButton
|
: <SecondaryButton
|
||||||
@ -370,39 +365,21 @@ const ProposalDetails = ({ chainId, address, connect, config }) => {
|
|||||||
</Box>
|
</Box>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{isSmallScreen
|
<TableContainer>
|
||||||
? <Box display="flex" flexDirection="column">
|
<Table aria-label="Available bonds" style={{ tableLayout: "fixed" }}>
|
||||||
{proposalDetails?.map((metadata, index) => {
|
<TableHead>
|
||||||
return parseFunctionCalldata({
|
<TableRow>
|
||||||
metadata,
|
<TableCell align="center" style={{ padding: "8px 0" }}>Function</TableCell>
|
||||||
index,
|
<TableCell align="center" style={{ padding: "8px 0" }}>Target</TableCell>
|
||||||
chainId,
|
<TableCell align="center" style={{ padding: "8px 0" }}>Calldata</TableCell>
|
||||||
nativeCoin: nativeCurrency,
|
<TableCell align="center" style={{ padding: "8px 0" }}>Value</TableCell>
|
||||||
isTable: false,
|
</TableRow>
|
||||||
});
|
</TableHead>
|
||||||
})}
|
<TableBody>{proposalDetails?.map((metadata, index) => {
|
||||||
</Box>
|
return parseFunctionCalldata(metadata, index, chainId, nativeCurrency);
|
||||||
: <TableContainer>
|
})}</TableBody>
|
||||||
<Table aria-label="Available bonds" style={{ tableLayout: "fixed" }}>
|
</Table>
|
||||||
<TableHead>
|
</TableContainer>
|
||||||
<TableRow>
|
|
||||||
<TableCell align="center" style={{ padding: "8px 0" }}>Function</TableCell>
|
|
||||||
<TableCell align="center" style={{ padding: "8px 0" }}>Target</TableCell>
|
|
||||||
<TableCell align="center" style={{ padding: "8px 0" }}>Calldata</TableCell>
|
|
||||||
<TableCell align="center" style={{ padding: "8px 0" }}>Value</TableCell>
|
|
||||||
</TableRow>
|
|
||||||
</TableHead>
|
|
||||||
<TableBody>{proposalDetails?.map((metadata, index) => {
|
|
||||||
return parseFunctionCalldata({
|
|
||||||
metadata,
|
|
||||||
index,
|
|
||||||
chainId,
|
|
||||||
nativeCoin: nativeCurrency,
|
|
||||||
});
|
|
||||||
})}</TableBody>
|
|
||||||
</Table>
|
|
||||||
</TableContainer>
|
|
||||||
}
|
|
||||||
</Paper>
|
</Paper>
|
||||||
</Container>
|
</Container>
|
||||||
</Box>
|
</Box>
|
||||||
@ -441,12 +418,7 @@ const VotingTimeline = ({ connect, handleExecute, handleRelease, proposalLocked,
|
|||||||
disabled={isPending || state !== 4}
|
disabled={isPending || state !== 4}
|
||||||
onClick={() => address === "" ? connect() : handleExecute()}
|
onClick={() => address === "" ? connect() : handleExecute()}
|
||||||
>
|
>
|
||||||
{address === ""
|
{address === "" ? "Connect" : state === 4 ? "Execute" : convertStatusToLabel(state)}
|
||||||
? "Connect"
|
|
||||||
: state !== 4
|
|
||||||
? convertStatusToLabel(state)
|
|
||||||
: isPending ? "Executing..." : "Execute"
|
|
||||||
}
|
|
||||||
</SecondaryButton>
|
</SecondaryButton>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@ -349,11 +349,10 @@ const ProposalFilterTrigger = ({ trigger, setTrigger }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const convertDeadline = (deadline, blockNumber, chainId) => {
|
const convertDeadline = (deadline, blockNumber, chainId) => {
|
||||||
const alreadyHappened = blockNumber > deadline;
|
const diff = blockNumber > deadline ? blockNumber - deadline : deadline - blockNumber;
|
||||||
const diff = alreadyHappened ? blockNumber - deadline : deadline - blockNumber;
|
|
||||||
const voteSeconds = Number(diff * networkAvgBlockSpeed(chainId));
|
const voteSeconds = Number(diff * networkAvgBlockSpeed(chainId));
|
||||||
|
|
||||||
const result = prettifySeconds(voteSeconds, "min");
|
const result = prettifySeconds(voteSeconds, "mins");
|
||||||
if (result === "now") {
|
if (result === "now") {
|
||||||
return new Date(Date.now()).toLocaleDateString('en-US', {
|
return new Date(Date.now()).toLocaleDateString('en-US', {
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
@ -362,10 +361,7 @@ const convertDeadline = (deadline, blockNumber, chainId) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const prefix = alreadyHappened ? "" : "in ";
|
return `in ${result}`;
|
||||||
const postfix = alreadyHappened ? " ago" : "";
|
|
||||||
|
|
||||||
return `${prefix}${result}${postfix}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ProposalsList;
|
export default ProposalsList;
|
||||||
|
|||||||
@ -27,5 +27,13 @@ export const AuditReservesSteps = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const AuditReservesParsed = (props) => {
|
export const AuditReservesParsed = (props) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{props.isTable && <AuditReservesParsedCell {...props} />}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const AuditReservesParsedCell = (props) => {
|
||||||
return <ParsedCell {...props} />
|
return <ParsedCell {...props} />
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,6 @@ export const prepareCreateBondDescription = "function creates a new bond market
|
|||||||
export const CreateBondParsed = (props) => {
|
export const CreateBondParsed = (props) => {
|
||||||
const [isOpened, setIsOpened] = useState(false);
|
const [isOpened, setIsOpened] = useState(false);
|
||||||
const { symbol: ftsoSymbol } = useTokenSymbol(props.chainId, "FTSO");
|
const { symbol: ftsoSymbol } = useTokenSymbol(props.chainId, "FTSO");
|
||||||
console.log(props)
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Modal
|
<Modal
|
||||||
@ -52,11 +51,15 @@ export const CreateBondParsed = (props) => {
|
|||||||
<CreateBondSteps args={props.args} ftsoSymbol={ftsoSymbol} nativeCurrency={props.nativeCoin} {...props} />
|
<CreateBondSteps args={props.args} ftsoSymbol={ftsoSymbol} nativeCurrency={props.nativeCoin} {...props} />
|
||||||
</Box>
|
</Box>
|
||||||
</Modal>
|
</Modal>
|
||||||
<ParsedCell isOpened={isOpened} setIsOpened={setIsOpened} {...props} />
|
{props.isTable && <CreateBondParsedCell isOpened={isOpened} setIsOpened={setIsOpened} {...props}/>}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CreateBondParsedCell = (props) => {
|
||||||
|
return <ParsedCell {...props} />
|
||||||
|
}
|
||||||
|
|
||||||
export const CreateBondSteps = ({ nativeCurrency, ftsoSymbol, chainId, toInitialStep, addCalldata, args }) => {
|
export const CreateBondSteps = ({ nativeCurrency, ftsoSymbol, chainId, toInitialStep, addCalldata, args }) => {
|
||||||
const createMode = args === undefined;
|
const createMode = args === undefined;
|
||||||
|
|
||||||
|
|||||||
@ -45,11 +45,15 @@ export const SetAdjustmentParsed = (props) => {
|
|||||||
<SetAdjustmentSteps {...props} />
|
<SetAdjustmentSteps {...props} />
|
||||||
</Box>
|
</Box>
|
||||||
</Modal>
|
</Modal>
|
||||||
<ParsedCell isOpened={isOpened} setIsOpened={setIsOpened} {...props} />
|
{props.isTable && <SetAdjustmentParsedCell isOpened={isOpened} setIsOpened={setIsOpened} {...props} />}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SetAdjustmentParsedCell = (props) => {
|
||||||
|
return <ParsedCell {...props} />
|
||||||
|
}
|
||||||
|
|
||||||
export const SetAdjustmentSteps = ({ chainId, toInitialStep, addCalldata, args }) => {
|
export const SetAdjustmentSteps = ({ chainId, toInitialStep, addCalldata, args }) => {
|
||||||
const createMode = args === undefined;
|
const createMode = args === undefined;
|
||||||
|
|
||||||
|
|||||||
@ -44,14 +44,7 @@ const identifyAction = (calldata) => {
|
|||||||
return decoded;
|
return decoded;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const parseFunctionCalldata = ({
|
export const parseFunctionCalldata = (metadata, index, chainId, nativeCoin, removeCalldata) => {
|
||||||
metadata,
|
|
||||||
index,
|
|
||||||
chainId,
|
|
||||||
nativeCoin,
|
|
||||||
removeCalldata,
|
|
||||||
isTable = true,
|
|
||||||
}) => {
|
|
||||||
const { label, calldata, target, value } = metadata;
|
const { label, calldata, target, value } = metadata;
|
||||||
const { functionName, args } = identifyAction(calldata);
|
const { functionName, args } = identifyAction(calldata);
|
||||||
const labelOrName = label ?? (functionName ?? "Unknown");
|
const labelOrName = label ?? (functionName ?? "Unknown");
|
||||||
@ -61,7 +54,7 @@ export const parseFunctionCalldata = ({
|
|||||||
switch (functionName) {
|
switch (functionName) {
|
||||||
case "auditReserves":
|
case "auditReserves":
|
||||||
return <AuditReservesParsed
|
return <AuditReservesParsed
|
||||||
isTable={isTable}
|
isTable
|
||||||
key={index}
|
key={index}
|
||||||
calldata={calldata}
|
calldata={calldata}
|
||||||
label={labelOrName}
|
label={labelOrName}
|
||||||
@ -74,7 +67,7 @@ export const parseFunctionCalldata = ({
|
|||||||
/>;
|
/>;
|
||||||
case "setAdjustment":
|
case "setAdjustment":
|
||||||
return <SetAdjustmentParsed
|
return <SetAdjustmentParsed
|
||||||
isTable={isTable}
|
isTable
|
||||||
args={args}
|
args={args}
|
||||||
key={index}
|
key={index}
|
||||||
calldata={calldata}
|
calldata={calldata}
|
||||||
@ -88,7 +81,7 @@ export const parseFunctionCalldata = ({
|
|||||||
/>;
|
/>;
|
||||||
case "create":
|
case "create":
|
||||||
return <CreateBondParsed
|
return <CreateBondParsed
|
||||||
isTable={isTable}
|
isTable
|
||||||
args={args}
|
args={args}
|
||||||
key={index}
|
key={index}
|
||||||
calldata={calldata}
|
calldata={calldata}
|
||||||
@ -102,7 +95,7 @@ export const parseFunctionCalldata = ({
|
|||||||
/>;
|
/>;
|
||||||
default:
|
default:
|
||||||
return <ParsedCell
|
return <ParsedCell
|
||||||
isTable={isTable}
|
isTable
|
||||||
key={index}
|
key={index}
|
||||||
calldata={calldata}
|
calldata={calldata}
|
||||||
label="Unknown"
|
label="Unknown"
|
||||||
@ -257,7 +250,6 @@ export const ArgumentInput = ({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: rename
|
|
||||||
export const ParsedCell = (props) => {
|
export const ParsedCell = (props) => {
|
||||||
const [isCopied, setIsCopied] = useState(false);
|
const [isCopied, setIsCopied] = useState(false);
|
||||||
|
|
||||||
@ -283,86 +275,34 @@ export const ParsedCell = (props) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (props.isTable) {
|
|
||||||
return (
|
|
||||||
<TableRow id={props.id + `--proposalFunction`} data-testid={props.id + `--proposalFunction`}>
|
|
||||||
<TableCell align="center" style={{ padding: "8px 0" }}>
|
|
||||||
<Typography>{props.label}</Typography>
|
|
||||||
</TableCell>
|
|
||||||
|
|
||||||
<TableCell align="center" style={{ padding: "8px 0" }}>
|
|
||||||
<Link href={etherscanLink} target="_blank" rel="noopener noreferrer">
|
|
||||||
<Typography>{shorten(props.target)}</Typography>
|
|
||||||
</Link>
|
|
||||||
</TableCell>
|
|
||||||
|
|
||||||
<TableCell align="center" style={{ padding: "8px 0" }}>
|
|
||||||
<Link onClick={handleCalldataCopy} target="_blank" rel="noopener noreferrer">
|
|
||||||
<Typography>{shorten(props.calldata)}</Typography>
|
|
||||||
</Link>
|
|
||||||
</TableCell>
|
|
||||||
|
|
||||||
<TableCell align="center" style={{ padding: "8px 0" }}>
|
|
||||||
<Typography>{formatCurrency(props.value, 4, props.nativeCoin)}</Typography>
|
|
||||||
</TableCell>
|
|
||||||
|
|
||||||
<TableCell>
|
|
||||||
<div style={{ display: 'flex', gap: '8px' }}>
|
|
||||||
{props.args && <TertiaryButton fullWidth onClick={() => props.setIsOpened(!props.isOpened)}>View</TertiaryButton>}
|
|
||||||
{props.remove && <TertiaryButton fullWidth onClick={() => props.remove()}>Delete</TertiaryButton>}
|
|
||||||
</div>
|
|
||||||
</TableCell>
|
|
||||||
</TableRow>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<TableRow id={props.id + `--proposalFunction`} data-testid={props.id + `--proposalFunction`}>
|
||||||
id={props.id + `--proposalFunction`}
|
<TableCell align="center" style={{ padding: "8px 0" }}>
|
||||||
data-testid={props.id + `--proposalFunction`}
|
|
||||||
display="flex"
|
|
||||||
flexDirection="column"
|
|
||||||
>
|
|
||||||
<Box display="flex" justifyContent="space-between">
|
|
||||||
<Typography>{`Function ${props.id + 1}`}</Typography>
|
|
||||||
<Typography>{props.label}</Typography>
|
<Typography>{props.label}</Typography>
|
||||||
</Box>
|
</TableCell>
|
||||||
|
|
||||||
<Box display="flex" justifyContent="space-between">
|
<TableCell align="center" style={{ padding: "8px 0" }}>
|
||||||
<Typography>Target</Typography>
|
|
||||||
<Link href={etherscanLink} target="_blank" rel="noopener noreferrer">
|
<Link href={etherscanLink} target="_blank" rel="noopener noreferrer">
|
||||||
<Typography>{shorten(props.target)}</Typography>
|
<Typography>{shorten(props.target)}</Typography>
|
||||||
</Link>
|
</Link>
|
||||||
</Box>
|
</TableCell>
|
||||||
|
|
||||||
<Box display="flex" justifyContent="space-between">
|
<TableCell align="center" style={{ padding: "8px 0" }}>
|
||||||
<Typography>Calldata</Typography>
|
|
||||||
<Link onClick={handleCalldataCopy} target="_blank" rel="noopener noreferrer">
|
<Link onClick={handleCalldataCopy} target="_blank" rel="noopener noreferrer">
|
||||||
<Typography>{shorten(props.calldata)}</Typography>
|
<Typography>{shorten(props.calldata)}</Typography>
|
||||||
</Link>
|
</Link>
|
||||||
</Box>
|
</TableCell>
|
||||||
|
|
||||||
<Box display="flex" justifyContent="space-between">
|
<TableCell align="center" style={{ padding: "8px 0" }}>
|
||||||
<Typography>Value</Typography>
|
<Typography>{formatCurrency(props.value, 4, props.nativeCoin)}</Typography>
|
||||||
<Link onClick={handleCalldataCopy} target="_blank" rel="noopener noreferrer">
|
</TableCell>
|
||||||
<Typography>{formatCurrency(props.value, 4, props.nativeCoin)}</Typography>
|
|
||||||
</Link>
|
|
||||||
</Box>
|
|
||||||
|
|
||||||
{(props.args || props.remove) && <Box
|
<TableCell>
|
||||||
display="flex"
|
<div style={{ display: 'flex', gap: '8px' }}>
|
||||||
flexDirection="row"
|
{props.args && <TertiaryButton fullWidth onClick={() => props.setIsOpened(!props.isOpened)}>View</TertiaryButton>}
|
||||||
justifyContent="space-between"
|
{props.remove && <TertiaryButton fullWidth onClick={() => props.remove()}>Delete</TertiaryButton>}
|
||||||
gap="10px"
|
</div>
|
||||||
marginTop="10px"
|
</TableCell>
|
||||||
>
|
</TableRow>
|
||||||
{props.args && <TertiaryButton fullWidth onClick={() => props.setIsOpened(!props.isOpened)}>View</TertiaryButton>}
|
|
||||||
{props.remove && <TertiaryButton fullWidth onClick={() => props.remove()}>Delete</TertiaryButton>}
|
|
||||||
</Box>}
|
|
||||||
|
|
||||||
<hr width="100%" style={{ margin: "20px 0" }} />
|
|
||||||
|
|
||||||
</Box>
|
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user