Skip to content

Commit

Permalink
Token Trade Implementation (#2055)
Browse files Browse the repository at this point in the history
* [WIP] Token Trade Plugin

* CreateProposal and ProposalSummary created for TokenTrade (untested)

* Token trade fixes for BN.js amoun types

* [WIP] Create token trade proposal

* updating images

* TokenTrade proposal summary fixed

* Eliminated console.logs

* Updated arc.js, test env and subgraph (#2072)

* Updated arc.js, test env and subgraph

* join and quit --> join to match new arc.js

* updated doc to Join instead of JoinAndQuit

* Form service - i18next

* [WIP] styling details

* Plugin manager create proposal modal has a left border and padding like the other modals (#2071)

* fix UI where votes screwed up (#2070)

* Better UI for DAO history page (#2069)

* Update documentation (#2062)

* updated documentation regarding i18next

* updated with global variables for styling

* example added

* better example

* refactor and fix issues relating 3box operations (#2018)

* upgrade provider packages

* update package-lock

* remove webpack from dependencies

* package-lock

* lint

* refactor, fix bugs

* better console info on errors

* clean up account profile loguc

* remove unused webReducer stuff

* merge conflict errors

* added some i18next

* upgrade provider packages

* remove webpack from dependencies

* package-lock

* refactor, fix bugs

* better console info on errors

* clean up account profile loguc

* merge conflict errors

* added some i18next

* package-lock

* 3box fix for identity-wallet

* fix bug in SAVE_THREEBOX

* revert to 3box 1.20.3

* fix error in follow

* remove Try Edit button

* clean up canEdit logic

* remove console.log statements

* fix merge conflict

* fix compile error

* Update translation.json

* update package-lock

* fix issue when a proposal card is not always clickable (#2077)

* revert subgraph endpoint domain (#2078)

* Support DAOs sort by total holdings (#2085)

* fething daos balances

* Support for DAOs total holdings ; sorting by total holdings

* Update translation.json

Missing comma after resolving conflicts.

* Styling for Token Trade Proposal Summary and Changed JoinAndQuit naming

* Merge fixes

* Added package.lock

* Minor adjustments due to changes in DAOs balances serivce that now returns balances only for registered DAOs (#2089)

* bumping arc.js version

* Updated chrome driver for tests (#2093)

* updated chrome driver for tests

* updated version also for seleniumArgs

* automatic update to the latest chrome driver

* updated webdriverio

* updated selenium

* Update .travis.yml

Removing auto version fetch as I'm not sure if it's working properly right now.
Will check it next time.

* dev-2 merged

* lint error fix

* fix lint

* removed unused import

* added token trade to required plugin permissions object

Co-authored-by: cbrzn <cesarbrazon10@gmail.com>
Co-authored-by: roienatan <34843014+roienatan@users.noreply.github.com>
Co-authored-by: Doug Kent <dkent600@users.noreply.github.com>
  • Loading branch information
4 people committed Sep 13, 2020
1 parent a46bdff commit 3e1e554
Show file tree
Hide file tree
Showing 11 changed files with 720 additions and 2 deletions.
160 changes: 160 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion src/actions/arcActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import {
ReputationFromTokenPlugin,
Proposal,
FundingRequestProposal,
JoinProposal,
IProposalState,
TokenTradeProposal,
JoinProposal,
} from "@daostack/arc.js";
import { IAsyncAction } from "actions/async";
import { getArc } from "arc";
Expand Down Expand Up @@ -91,6 +92,9 @@ async function tryRedeemProposal(proposalId: string, accountAddress: string, obs
case "Join":
await (proposal as JoinProposal).redeem().subscribe(...observer);
break;
case "TokenTrade":
await (proposal as TokenTradeProposal).redeem().subscribe(...observer);
break;
default:
break;
}
Expand Down
4 changes: 4 additions & 0 deletions src/components/Proposal/Create/CreateProposalPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import { pluginName } from "lib/pluginUtils";
import * as css from "./CreateProposal.scss";
import CreatePluginManagerProposal from "./PluginForms/CreatePluginManagerProposal";
import { of } from "rxjs";
import CreateTokenTradeProposal from "./PluginForms/CreateTokenTradeProposal";
import { ITokenTradeState } from "@daostack/arc.js";

type IExternalProps = RouteComponentProps<any>;

Expand Down Expand Up @@ -120,6 +122,8 @@ class CreateProposalPage extends React.Component<IProps, IStateProps> {
createPluginComponent = <CreatePluginRegistrarProposal {...props} pluginState={pluginState as IPluginRegistrarState} />;
} else if (pluginState.name === "SchemeFactory") {
createPluginComponent = <CreatePluginManagerProposal {...props} pluginState={pluginState as IPluginManagerState} />;
} else if (pluginState.name === "TokenTrade") {
createPluginComponent = <CreateTokenTradeProposal {...props} pluginState={pluginState as ITokenTradeState} />;
} else if (pluginState.name === "GenericScheme") {
const contractToCall = (pluginState as IGenericPluginState).pluginParams.contractToCall;
if (!contractToCall) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ export interface IFormValues {
fundingGoalDeadline: number;
rageQuitEnable: boolean;
};
TokenTrade: {
permissions: IPermissions;
votingParams: IGenesisProtocolFormValues;
}
SchemeRegistrar: {
permissions: IPermissions;
votingParamsRegister: IGenesisProtocolFormValues;
Expand Down Expand Up @@ -189,6 +193,15 @@ const defaultValues: IFormValues = {
genericCall: false,
},
},
TokenTrade: {
votingParams: { ...votingParams },
permissions: {
registerPlugins: false,
changeConstraints: false,
upgradeController: false,
genericCall: false,
},
},
Competition: {
votingParams: { ...votingParams },
permissions: {
Expand Down Expand Up @@ -392,6 +405,15 @@ class CreatePluginManagerProposal extends React.Component<IProps, IState> {
daoFactory: arc.getContractInfoByName("DAOFactoryInstance", LATEST_ARC_VERSION).address,
};
break;
case "TokenTrade":
proposalOptions.add.pluginInitParams = {
daoId: daoId,
votingMachine: votingMachine,
votingParams: gpFormValuesToVotingParams(values.ContributionReward.votingParams),
voteOnBehalf: values.ContributionReward.votingParams.voteOnBehalf,
voteParamsHash: values.ContributionReward.votingParams.voteParamsHash,
};
break;
case "SchemeRegistrar":
proposalOptions.add.pluginInitParams = {
daoId: daoId,
Expand Down
Loading

0 comments on commit 3e1e554

Please sign in to comment.