diff --git a/src/assets/locales/en/translation.json b/src/assets/locales/en/translation.json index abd7d86ab..1d1e9f700 100644 --- a/src/assets/locales/en/translation.json +++ b/src/assets/locales/en/translation.json @@ -31,5 +31,6 @@ "3BoxLoginSuccess": "Logged in to 3Box", "3BoxProfileSuccess": "Profile data saved to 3Box", "Following": "Now following", - "UnFollowing": "No longer following" + "UnFollowing": "No longer following", + "Raw call data": "Raw call data" } diff --git a/src/components/Proposal/ProposalSummary/ProposalSummaryCO2ken.tsx b/src/components/Proposal/ProposalSummary/ProposalSummaryCO2ken.tsx index 8fc2b35c4..0367d51c7 100644 --- a/src/components/Proposal/ProposalSummary/ProposalSummaryCO2ken.tsx +++ b/src/components/Proposal/ProposalSummary/ProposalSummaryCO2ken.tsx @@ -3,9 +3,11 @@ import { IGenericPluginProposalState } from "@daostack/arc.js"; import BN = require("bn.js"); import classNames from "classnames"; import { GenericPluginInfo } from "genericPluginRegistry"; -import { formatTokens } from "lib/util"; +import { formatTokens, truncateWithEllipses } from "lib/util"; import * as React from "react"; import * as css from "./ProposalSummary.scss"; +import CopyToClipboard from "components/Shared/CopyToClipboard"; +import i18next from "i18next"; interface IProps { genericPluginInfo: GenericPluginInfo; @@ -16,6 +18,14 @@ interface IProps { export default class ProposalSummaryCO2ken extends React.Component { + private rawCallData(proposalState: IGenericPluginProposalState) { + return <> +

{i18next.t("Raw call data")}:

+
+        {truncateWithEllipses(proposalState.callData, 66)}
+      
+ ; + } public render(): RenderOutput { const { proposalState, detailView, genericPluginInfo, transactionModal } = this.props; let decodedCallData: any; @@ -47,7 +57,7 @@ export default class ProposalSummaryCO2ken extends React.Component {action.label} - { detailView ? + {detailView ?

@@ -64,6 +74,7 @@ export default class ProposalSummaryCO2ken extends React.Component {ipfsHashValue}

+ {this.rawCallData(proposalState)}
: "" } @@ -84,6 +95,7 @@ export default class ProposalSummaryCO2ken extends React.Component
{-1}
It allows the the CO2ken contract to move DAI held by the DAO. This way, the DAO can offset its emissions by calling:
offsetCarbon()
+ {this.rawCallData(proposalState)} : "" } @@ -100,6 +112,7 @@ export default class ProposalSummaryCO2ken extends React.Component Executing this proposal will call the function
{action.id}()
It transfers all the DAI stored in the CO2ken contract to the DAO. + {this.rawCallData(proposalState)} : "" } @@ -116,12 +129,13 @@ export default class ProposalSummaryCO2ken extends React.Component {detailView ?
- Executing this proposal will call the function + Executing this proposal will call the function
{action.id}()
- DAI are sent to the CO2ken contract to retire a respecive number of CO2kens. One CO2ken is equivalent to a ton of carbon emissions. The total amount of DAI which will be sent to the contract is: + DAI are sent to the CO2ken contract to retire a respecive number of CO2kens. One CO2ken is equivalent to a ton of carbon emissions. The total amount of DAI which will be sent to the contract is:
                   {formatTokens(new BN(value), field.unit, field.decimals)}
                 
+ {this.rawCallData(proposalState)}
: "" } @@ -139,13 +153,14 @@ export default class ProposalSummaryCO2ken extends React.Component {detailView ?
- Executing this proposal will call the function + Executing this proposal will call the function
{action.id}()
with value
-                  { field.label }: {formatTokens(new BN(value), field.unit, field.decimals)}
+                  {field.label}: {formatTokens(new BN(value), field.unit, field.decimals)}
                 
The value describes the amount of carbon tons the DAO wants to offset. + {this.rawCallData(proposalState)}
: "" } @@ -161,10 +176,11 @@ export default class ProposalSummaryCO2ken extends React.Component {detailView ?
- Executing this proposal will call the function + Executing this proposal will call the function
{action.id}()
with the new owner‘s address being
{decodedCallData.values[0]}
+ {this.rawCallData(proposalState)}
: "" } diff --git a/src/components/Proposal/ProposalSummary/ProposalSummaryDutchX.tsx b/src/components/Proposal/ProposalSummary/ProposalSummaryDutchX.tsx index 4723ea212..9b5297ffe 100644 --- a/src/components/Proposal/ProposalSummary/ProposalSummaryDutchX.tsx +++ b/src/components/Proposal/ProposalSummary/ProposalSummaryDutchX.tsx @@ -3,9 +3,11 @@ import { IGenericPluginProposalState } from "@daostack/arc.js"; import BN = require("bn.js"); import classNames from "classnames"; import { GenericPluginInfo } from "genericPluginRegistry"; -import { formatTokens, linkToEtherScan } from "lib/util"; +import { formatTokens, linkToEtherScan, truncateWithEllipses } from "lib/util"; import * as React from "react"; import * as css from "./ProposalSummary.scss"; +import CopyToClipboard from "components/Shared/CopyToClipboard"; +import i18next from "i18next"; interface IProps { genericPluginInfo: GenericPluginInfo; @@ -16,6 +18,15 @@ interface IProps { export default class ProposalSummaryDutchX extends React.Component { + private rawCallData(proposalState: IGenericPluginProposalState) { + return <> +

{i18next.t("Raw call data")}:

+
+        {truncateWithEllipses(proposalState.callData, 66)}
+      
+ ; + } + public render(): RenderOutput { const { proposalState, detailView, genericPluginInfo, transactionModal } = this.props; let decodedCallData: any; @@ -50,13 +61,14 @@ export default class ProposalSummaryDutchX extends React.Component return (
-   +   {action.label} {renderValueHtml()} - { detailView ? + {detailView ?
-
{ action.fields[0].label}: {decodedCallData.values[0]}
+
{action.fields[0].label}: {decodedCallData.values[0]}
+ {this.rawCallData(proposalState)}
: "" } @@ -66,13 +78,14 @@ export default class ProposalSummaryDutchX extends React.Component return (
-   +   {action.label} {renderValueHtml()} - { detailView ? + {detailView ?
New oracle address: {decodedCallData.values[0]} + {this.rawCallData(proposalState)}
: "" } @@ -82,13 +95,14 @@ export default class ProposalSummaryDutchX extends React.Component return (
-   +   {action.label} {renderValueHtml()} - { detailView ? + {detailView ?
New owner address: {decodedCallData.values[0]} + {this.rawCallData(proposalState)}
: "" } @@ -102,11 +116,12 @@ export default class ProposalSummaryDutchX extends React.Component {decodedCallData.values[1] ? "Whitelist" : "Delist"} {decodedCallData.values[0].length} token{decodedCallData.values[0].length !== 1 ? "s" : ""} {renderValueHtml()} - { detailView ? + {detailView ?
    {decodedCallData.values[0].map((token: string) =>
  • {token}
  • )}
+ {this.rawCallData(proposalState)}
: "" } @@ -120,12 +135,13 @@ export default class ProposalSummaryDutchX extends React.Component return (
-   - { field.label }: {formatTokens(new BN(value), field.unit, field.decimals)} +   + {field.label}: {formatTokens(new BN(value), field.unit, field.decimals)} {renderValueHtml()} {detailView ?
+ {this.rawCallData(proposalState)}
: "" } diff --git a/src/components/Proposal/ProposalSummary/ProposalSummaryKnownGenericPlugin.tsx b/src/components/Proposal/ProposalSummary/ProposalSummaryKnownGenericPlugin.tsx index a15ae7ba5..564ddafbe 100644 --- a/src/components/Proposal/ProposalSummary/ProposalSummaryKnownGenericPlugin.tsx +++ b/src/components/Proposal/ProposalSummary/ProposalSummaryKnownGenericPlugin.tsx @@ -10,6 +10,7 @@ import ProposalSummaryDutchX from "./ProposalSummaryDutchX"; import ProposalSummaryStandardBounties from "./ProposalSummaryStandardBounties"; import ProposalSummaryCO2ken from "./ProposalSummaryCO2ken"; import ProposalSummaryNFTManager from "./ProposalSummaryNFTManager"; +import i18next from "i18next"; interface IExternalProps { beneficiaryProfile?: IProfileState; @@ -33,7 +34,7 @@ export default class ProposalSummary extends React.Component { return
{truncatedValue}{isArrayItem ? "," : ""} + >{truncatedValue}{isArrayItem ? "," : ""}
; } else { @@ -118,6 +119,11 @@ export default class ProposalSummary extends React.Component {
{proposalState.contractToCall}
sending to contract:
{formatTokens(proposalState.value)} ETH
+ + {i18next.t("Raw call data")}: +
+            {truncateWithEllipses(proposalState.callData, 66)}
+          
: "" } diff --git a/src/components/Proposal/ProposalSummary/ProposalSummaryNFTManager.tsx b/src/components/Proposal/ProposalSummary/ProposalSummaryNFTManager.tsx index fe422899a..81a4de4ff 100644 --- a/src/components/Proposal/ProposalSummary/ProposalSummaryNFTManager.tsx +++ b/src/components/Proposal/ProposalSummary/ProposalSummaryNFTManager.tsx @@ -1,9 +1,11 @@ import { IGenericPluginProposalState, IDAOState } from "@daostack/arc.js"; import * as classNames from "classnames"; import { GenericPluginInfo } from "genericPluginRegistry"; -import { linkToEtherScan } from "lib/util"; +import { linkToEtherScan, truncateWithEllipses } from "lib/util"; import * as React from "react"; import * as css from "./ProposalSummary.scss"; +import CopyToClipboard from "components/Shared/CopyToClipboard"; +import i18next from "i18next"; const Web3 = require("web3"); interface IProps { @@ -55,20 +57,24 @@ export default class ProposalSummaryNFTManager extends React.Component } - { detailView && + {detailView &&
-
+
TokenID: {decodedCallData.values[2]}
+
+ {i18next.t("Raw call data")}: + {truncateWithEllipses(proposalState.callData, 66)} +
}
diff --git a/src/components/Proposal/ProposalSummary/ProposalSummaryStandardBounties.tsx b/src/components/Proposal/ProposalSummary/ProposalSummaryStandardBounties.tsx index f12865515..bfa11efcb 100644 --- a/src/components/Proposal/ProposalSummary/ProposalSummaryStandardBounties.tsx +++ b/src/components/Proposal/ProposalSummary/ProposalSummaryStandardBounties.tsx @@ -1,9 +1,11 @@ import { IGenericPluginProposalState } from "@daostack/arc.js"; import * as classNames from "classnames"; import { GenericPluginInfo } from "genericPluginRegistry"; -import { linkToEtherScan, fromWeiToString } from "lib/util"; +import { linkToEtherScan, fromWeiToString, truncateWithEllipses } from "lib/util"; import * as React from "react"; import * as css from "./ProposalSummary.scss"; +import CopyToClipboard from "components/Shared/CopyToClipboard"; +import i18next from "i18next"; interface IProps { genericPluginInfo: GenericPluginInfo; @@ -14,6 +16,14 @@ interface IProps { export default class ProposalSummaryStandardBounties extends React.Component { + private rawCallData(proposalState: IGenericPluginProposalState) { + return <> +
{i18next.t("Raw call data")}:  + {truncateWithEllipses(proposalState.callData, 66)} +
+ ; + } + public render(): RenderOutput { const { proposalState, detailView, genericPluginInfo, transactionModal } = this.props; @@ -43,15 +53,15 @@ export default class ProposalSummaryStandardBounties extends React.Component - {action.label} + {action.label} - { detailView && + {detailView &&
Bounty Details: {decodedCallData.values[3]}.
- Deadline: {(new Date(parseInt(decodedCallData.values[4], 10)*1000)).toString()}. + Deadline: {(new Date(parseInt(decodedCallData.values[4], 10) * 1000)).toString()}.
Amount funded: {fromWeiToString(decodedCallData.values[7])} {decodedCallData.values[6].toString() === "0" ? "ETH" : "tokens"}. @@ -68,6 +78,7 @@ export default class ProposalSummaryStandardBounties extends React.Component Approver: {decodedCallData.values[2]}
+ {this.rawCallData(proposalState)}
}
@@ -76,9 +87,9 @@ export default class ProposalSummaryStandardBounties extends React.Component - {action.label} + {action.label} - { detailView && + {detailView &&
Contribution Amount: {fromWeiToString(decodedCallData.values[2])} @@ -89,6 +100,7 @@ export default class ProposalSummaryStandardBounties extends React.Component Sender: {decodedCallData.values[0]}
+ {this.rawCallData(proposalState)}
}
@@ -97,9 +109,9 @@ export default class ProposalSummaryStandardBounties extends React.Component - {action.label} + {action.label} - { detailView && + {detailView &&
Refund for contribution IDs: @@ -120,6 +132,7 @@ export default class ProposalSummaryStandardBounties extends React.Component Issuer ID: {decodedCallData.values[2]}
+ {this.rawCallData(proposalState)}
} @@ -128,9 +141,9 @@ export default class ProposalSummaryStandardBounties extends React.Component - {action.label} + {action.label} - { detailView && + {detailView &&
Draining {fromWeiToString(decodedCallData.values[3])} amount of tokens for bounty ID {decodedCallData.values[1]}. @@ -141,6 +154,7 @@ export default class ProposalSummaryStandardBounties extends React.Component Issuer ID: {decodedCallData.values[2]}
+ {this.rawCallData(proposalState)}
} @@ -149,9 +163,9 @@ export default class ProposalSummaryStandardBounties extends React.Component - {action.label} + {action.label} - { detailView && + {detailView &&
Accepting submission ID {decodedCallData.values[2]} for bounty ID {decodedCallData.values[1]} of {fromWeiToString(decodedCallData.values[4])} tokens. @@ -162,6 +176,7 @@ export default class ProposalSummaryStandardBounties extends React.Component Approver ID: {decodedCallData.values[3]}
+ {this.rawCallData(proposalState)}
} @@ -170,9 +185,9 @@ export default class ProposalSummaryStandardBounties extends React.Component - {action.label} + {action.label} - { detailView && + {detailView &&
For Bounty ID {decodedCallData.values[1]}, @@ -201,7 +216,7 @@ export default class ProposalSummaryStandardBounties extends React.Component{decodedCallData.values[5]}
- Change bounty deadline to {(new Date(parseInt(decodedCallData.values[6], 10)*1000)).toString()} + Change bounty deadline to {(new Date(parseInt(decodedCallData.values[6], 10) * 1000)).toString()}
Sender: {decodedCallData.values[0]} @@ -209,6 +224,7 @@ export default class ProposalSummaryStandardBounties extends React.Component Issuer ID: {decodedCallData.values[2]}
+ {this.rawCallData(proposalState)}
} @@ -217,9 +233,9 @@ export default class ProposalSummaryStandardBounties extends React.Component - {action.label} + {action.label} - { detailView && + {detailView &&
Change details of bounty ID {decodedCallData.values[1]} to {decodedCallData.values[3]}. @@ -230,6 +246,7 @@ export default class ProposalSummaryStandardBounties extends React.Component Issuer ID: {decodedCallData.values[2]}
+ {this.rawCallData(proposalState)}
} @@ -238,12 +255,12 @@ export default class ProposalSummaryStandardBounties extends React.Component - {action.label} + {action.label} - { detailView && + {detailView &&
- Change deadline of bounty ID {decodedCallData.values[1]} to {(new Date(parseInt(decodedCallData.values[3], 10)*1000)).toString()} + Change deadline of bounty ID {decodedCallData.values[1]} to {(new Date(parseInt(decodedCallData.values[3], 10) * 1000)).toString()}
Sender: {decodedCallData.values[0]} @@ -251,6 +268,7 @@ export default class ProposalSummaryStandardBounties extends React.Component Issuer ID: {decodedCallData.values[2]}
+ {this.rawCallData(proposalState)}
} @@ -259,9 +277,9 @@ export default class ProposalSummaryStandardBounties extends React.Component - {action.label} + {action.label} - { detailView && + {detailView &&
    Accept submission of: @@ -285,6 +303,7 @@ export default class ProposalSummaryStandardBounties extends React.Component Bounty Details: {decodedCallData.values[3]}
    + {this.rawCallData(proposalState)}
} @@ -293,9 +312,9 @@ export default class ProposalSummaryStandardBounties extends React.Component - {action.label} + {action.label} - { detailView && + {detailView &&
Change approvers to: @@ -316,6 +335,7 @@ export default class ProposalSummaryStandardBounties extends React.Component Issuer ID: {decodedCallData.values[2]}
+ {this.rawCallData(proposalState)}
} @@ -324,9 +344,9 @@ export default class ProposalSummaryStandardBounties extends React.Component - {action.label} + {action.label} - { detailView && + {detailView &&
Change issuers to: @@ -347,6 +367,7 @@ export default class ProposalSummaryStandardBounties extends React.Component Issuer ID: {decodedCallData.values[2]}
+ {this.rawCallData(proposalState)}
}