Update copy, fetch data
This commit is contained in:
parent
4ccd2d4955
commit
251ae50d3e
@ -123,8 +123,8 @@ render(
|
||||
<Route exact={true} path={WebsitePaths.Ecosystem} component={NextEcosystem as any} />
|
||||
<Route exact={true} path={`${WebsitePaths.Vote}/:zeip`} component={Governance as any} />
|
||||
{/* TODO: Uncomment the VoteIndex route */}
|
||||
<Redirect from={WebsitePaths.Vote} to={`${WebsitePaths.Vote}/zeip-23`} />
|
||||
{/* <Route exact={true} path={WebsitePaths.Vote} component={VoteIndex as any} /> */}
|
||||
{/* <Redirect from={WebsitePaths.Vote} to={`${WebsitePaths.Vote}/zeip-23`} /> */}
|
||||
<Route exact={true} path={WebsitePaths.Vote} component={VoteIndex as any} />
|
||||
<Route exact={true} path={WebsitePaths.Extensions} component={Extensions as any} />
|
||||
<Route
|
||||
exact={true}
|
||||
|
@ -69,34 +69,34 @@ export const proposals: Proposals = {
|
||||
39: {
|
||||
zeipId: 39,
|
||||
title: 'StaticCallAssetProxy',
|
||||
summary: `This ZEIP introduces the StaticCallAssetProxy, which adds support for trading arbitrary bundles of assets to 0x protocol. Historically, only a single asset could be traded per each side of a trade. With the introduction of the MultiAssetProxy, users will be able to trade multiple ERC721 assets or even mix ERC721 and ERC20 assets within a single order.`,
|
||||
url: 'https://blog.0xproject.com/zeip-23-trade-bundles-of-assets-fe69eb3ed960',
|
||||
voteStartDate: moment().add(2, 'days'),
|
||||
voteEndDate: moment().add(3, 'days'),
|
||||
summary: `This ZEIP introduces the ability to validate stateful assets during settlement, ensuring the asset has not been modified.`,
|
||||
url: '',
|
||||
voteStartDate: moment(1563728400, 'X'),
|
||||
voteEndDate: moment(1564333200, 'X'),
|
||||
benefit: {
|
||||
title: 'Benefit',
|
||||
summary: `Supporting trades for bundles of assets has been one of the most commonly requested features since the launch of 0x v2. The idea for this feature originated from discussions with gaming and NFT related projects. However, this upgrade also provides utility to relayers for prediction markets or baskets of tokens. The MultiAssetProxy will enable brand new ways of trading.`,
|
||||
summary: `Stateful assets can be traded safely on 0x without the risk of front running attacks which can de-value the underlying asset. An asset is guaranteed by the 0x protocol to contain the same state as described in the order during settlement. `,
|
||||
rating: 3,
|
||||
links: [
|
||||
{
|
||||
text: 'Technical detail',
|
||||
url: 'https://github.com/0xProject/ZEIPs/issues/23',
|
||||
url: 'https://github.com/0xProject/ZEIPs/issues/39',
|
||||
},
|
||||
],
|
||||
},
|
||||
risks: {
|
||||
title: 'Risk',
|
||||
summary: `While the MultiAssetProxy’s code is relatively straightforward and has successfully undergone a full third-party audit, a bug within the code could result in the loss of user funds. Deploying the MultiAssetProxy is a hot upgrade that requires modifying the state of existing contracts within 0x protocol. The contracts being modified contain allowances to many users’ tokens. We encourage the community to verify the code, as well as the state changes.`,
|
||||
rating: 2,
|
||||
summary: `There is no risk in deploying ZEIP-39 as it has no ability to move assets from a users account.`,
|
||||
rating: 1,
|
||||
links: [
|
||||
{
|
||||
text: 'View Code',
|
||||
url:
|
||||
'https://github.com/0xProject/0x-monorepo/blob/development/contracts/asset-proxy/contracts/src/MultiAssetProxy.sol#L25',
|
||||
'',
|
||||
},
|
||||
{
|
||||
text: 'View Audit',
|
||||
url: 'https://github.com/ConsenSys/0x-audit-report-2018-12',
|
||||
url: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -104,69 +104,34 @@ export const proposals: Proposals = {
|
||||
24: {
|
||||
zeipId: 24,
|
||||
title: 'Support ERC-1155 MultiToken Standard',
|
||||
summary: `This ZEIP introduces the StaticCallAssetProxy, which adds support for trading arbitrary bundles of assets to 0x protocol. Historically, only a single asset could be traded per each side of a trade. With the introduction of the MultiAssetProxy, users will be able to trade multiple ERC721 assets or even mix ERC721 and ERC20 assets within a single order.`,
|
||||
url: 'https://blog.0xproject.com/zeip-23-trade-bundles-of-assets-fe69eb3ed960',
|
||||
voteStartDate: moment().subtract(2, 'days'),
|
||||
voteEndDate: moment().add(3, 'days'),
|
||||
summary: `This ZEIP introduces the ERC-1155 Asset Proxy, which adds support for trading ERC-1155 assets to 0x protocol. ERC-1155 is an evolution in token standards allowing mixed fungible and non-fungible assets within the same contract, enabling greater efficiency in the transfer and creation of new token concepts.`,
|
||||
url: 'https://github.com/0xProject/ZEIPs/issues/24',
|
||||
voteStartDate: moment(1563728400, 'X'),
|
||||
voteEndDate: moment(1564333200, 'X'),
|
||||
benefit: {
|
||||
title: 'Benefit',
|
||||
summary: `Supporting trades for bundles of assets has been one of the most commonly requested features since the launch of 0x v2. The idea for this feature originated from discussions with gaming and NFT related projects. However, this upgrade also provides utility to relayers for prediction markets or baskets of tokens. The MultiAssetProxy will enable brand new ways of trading.`,
|
||||
summary: `0x is designed to support numerous assets on the Ethereum blockchain. Adding support for the ERC1155 proxy enables new and more efficient types of trading such as batch transfers, shared deposit contracts and new types of tokens.`,
|
||||
rating: 3,
|
||||
links: [
|
||||
{
|
||||
text: 'Technical detail',
|
||||
url: 'https://github.com/0xProject/ZEIPs/issues/23',
|
||||
url: 'https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1155.md',
|
||||
},
|
||||
],
|
||||
},
|
||||
risks: {
|
||||
title: 'Risk',
|
||||
summary: `While the MultiAssetProxy’s code is relatively straightforward and has successfully undergone a full third-party audit, a bug within the code could result in the loss of user funds. Deploying the MultiAssetProxy is a hot upgrade that requires modifying the state of existing contracts within 0x protocol. The contracts being modified contain allowances to many users’ tokens. We encourage the community to verify the code, as well as the state changes.`,
|
||||
rating: 2,
|
||||
summary: `The ERC1155 AssetProxy’s code is relatively straightforward and has successfully undergone a full third-party audit. Any bug within the ERC1155 Asset Proxy is minimised to only ERC1155 assets.`,
|
||||
rating: 1,
|
||||
links: [
|
||||
{
|
||||
text: 'View Code',
|
||||
url:
|
||||
'https://github.com/0xProject/0x-monorepo/blob/development/contracts/asset-proxy/contracts/src/MultiAssetProxy.sol#L25',
|
||||
'https://github.com/0xProject/0x-monorepo/blob/development/contracts/asset-proxy/contracts/src/ERC1155Proxy.sol#L24',
|
||||
},
|
||||
{
|
||||
text: 'View Audit',
|
||||
url: 'https://github.com/ConsenSys/0x-audit-report-2018-12',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
25: {
|
||||
zeipId: 25,
|
||||
title: 'Support ERC-1155 MultiToken Standard',
|
||||
summary: `This ZEIP introduces the StaticCallAssetProxy, which adds support for trading arbitrary bundles of assets to 0x protocol. Historically, only a single asset could be traded per each side of a trade. With the introduction of the MultiAssetProxy, users will be able to trade multiple ERC721 assets or even mix ERC721 and ERC20 assets within a single order.`,
|
||||
url: 'https://blog.0xproject.com/zeip-23-trade-bundles-of-assets-fe69eb3ed960',
|
||||
voteStartDate: moment().subtract(2, 'days'),
|
||||
voteEndDate: moment().add(3, 'days'),
|
||||
benefit: {
|
||||
title: 'Benefit',
|
||||
summary: `Supporting trades for bundles of assets has been one of the most commonly requested features since the launch of 0x v2. The idea for this feature originated from discussions with gaming and NFT related projects. However, this upgrade also provides utility to relayers for prediction markets or baskets of tokens. The MultiAssetProxy will enable brand new ways of trading.`,
|
||||
rating: 3,
|
||||
links: [
|
||||
{
|
||||
text: 'Technical detail',
|
||||
url: 'https://github.com/0xProject/ZEIPs/issues/23',
|
||||
},
|
||||
],
|
||||
},
|
||||
risks: {
|
||||
title: 'Risk',
|
||||
summary: `While the MultiAssetProxy’s code is relatively straightforward and has successfully undergone a full third-party audit, a bug within the code could result in the loss of user funds. Deploying the MultiAssetProxy is a hot upgrade that requires modifying the state of existing contracts within 0x protocol. The contracts being modified contain allowances to many users’ tokens. We encourage the community to verify the code, as well as the state changes.`,
|
||||
rating: 2,
|
||||
links: [
|
||||
{
|
||||
text: 'View Code',
|
||||
url:
|
||||
'https://github.com/0xProject/0x-monorepo/blob/development/contracts/asset-proxy/contracts/src/MultiAssetProxy.sol#L25',
|
||||
},
|
||||
{
|
||||
text: 'View Audit',
|
||||
url: 'https://github.com/ConsenSys/0x-audit-report-2018-12',
|
||||
url: 'https://github.com/ConsenSys/0x-audit-report-2019-05',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -206,7 +206,7 @@ export class Governance extends React.Component<RouteComponentProps<any>> {
|
||||
};
|
||||
private async _fetchVoteStatusAsync(): Promise<void> {
|
||||
try {
|
||||
const voteDomain = utils.isProduction() ? `https://${configs.DOMAIN_VOTE}` : 'http://localhost:3000';
|
||||
const voteDomain = utils.isProduction() ? `https://${configs.DOMAIN_VOTE}` : `https://${configs.DOMAIN_VOTE}/staging`;
|
||||
const voteEndpoint = `${voteDomain}/v1/tally/${this._proposalData.zeipId}`;
|
||||
const response = await fetch(voteEndpoint, {
|
||||
method: 'get',
|
||||
|
@ -10,7 +10,9 @@ import { Heading, Paragraph } from 'ts/components/text';
|
||||
import { Proposal, proposals } from 'ts/pages/governance/data';
|
||||
import { VoteIndexCard } from 'ts/pages/governance/vote_index_card';
|
||||
import { TallyInterface } from 'ts/types';
|
||||
import { configs } from 'ts/utils/configs';
|
||||
import { documentConstants } from 'ts/utils/document_meta_constants';
|
||||
import { utils } from 'ts/utils/utils';
|
||||
|
||||
const ZEIP_IDS = Object.keys(proposals).map(idString => parseInt(idString, 10));
|
||||
const ZEIP_PROPOSALS: Proposal[] = ZEIP_IDS.map(id => proposals[id]).sort(
|
||||
@ -60,26 +62,49 @@ export class VoteIndex extends React.Component<VoteIndexProps, VoteIndexState> {
|
||||
</SiteWrap>
|
||||
);
|
||||
}
|
||||
private async _fetchVoteStatusAsync(zeipId: number): Promise<TallyInterface> {
|
||||
try {
|
||||
const voteDomain = utils.isProduction() ? `https://${configs.DOMAIN_VOTE}` : `https://${configs.DOMAIN_VOTE}/staging`;
|
||||
const voteEndpoint = `${voteDomain}/v1/tally/${zeipId}`;
|
||||
const response = await fetch(voteEndpoint, {
|
||||
method: 'get',
|
||||
mode: 'cors',
|
||||
credentials: 'same-origin',
|
||||
headers: {
|
||||
'content-type': 'application/json; charset=utf-8',
|
||||
},
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Request failed');
|
||||
}
|
||||
|
||||
const responseData = await response.json();
|
||||
let { no, yes } = responseData;
|
||||
yes = new BigNumber(yes);
|
||||
no = new BigNumber(no);
|
||||
const totalBalance = yes.plus(no);
|
||||
const tally = {
|
||||
...responseData,
|
||||
yes: new BigNumber(yes),
|
||||
no: new BigNumber(no),
|
||||
totalBalance,
|
||||
};
|
||||
return tally;
|
||||
} catch (e) {
|
||||
// Empty block
|
||||
return {
|
||||
yes: new BigNumber(0),
|
||||
no: new BigNumber(0),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private async _fetchTallysAsync(): Promise<void> {
|
||||
// TODO: Real implementation
|
||||
const getRandomInt = (max: string): BigNumber => {
|
||||
return new BigNumber(max).times(Math.random());
|
||||
};
|
||||
const bigNumber = '100000000000000000000000000';
|
||||
const generateRandomTally = (): TallyInterface => ({
|
||||
yes: getRandomInt(bigNumber),
|
||||
no: getRandomInt(bigNumber),
|
||||
});
|
||||
setTimeout(() => {
|
||||
const tallys = {
|
||||
23: generateRandomTally(),
|
||||
39: generateRandomTally(),
|
||||
24: generateRandomTally(),
|
||||
25: generateRandomTally(),
|
||||
};
|
||||
const tallyResponses = await Promise.all(ZEIP_IDS.map(async zeipId => this._fetchVoteStatusAsync(zeipId)));
|
||||
const tallys: {[key: number]: TallyInterface} = {};
|
||||
ZEIP_IDS.map((zeipId, i) => tallys[zeipId] = tallyResponses[i]);
|
||||
this.setState({ tallys });
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ const getDateString = (voteStartDate: moment.Moment, voteEndDate: moment.Moment)
|
||||
const voteTime = getVoteTime(voteStartDate, voteEndDate);
|
||||
const pstOffset = '-0800';
|
||||
const endDate = voteEndDate.utcOffset(pstOffset);
|
||||
const startDate = voteEndDate.utcOffset(pstOffset);
|
||||
const startDate = voteStartDate.utcOffset(pstOffset);
|
||||
if (voteTime === 'happening') {
|
||||
return `Ends ${endDate.format('MMMM Do YYYY, h:mm a')} PST`;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user