{"size": 1782, "ext": "js", "max_stars_repo_path": "src/components/Docs/Governance/GetCurrentVotes.js", "max_stars_repo_name": "VenusProtocol/venus-protocol-docs", "max_stars_repo_stars_event_min_datetime": "2021-05-06T22:43:51.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-01T06:54:52.000Z", "max_issues_repo_path": "src/components/Docs/Governance/GetCurrentVotes.js", "max_issues_repo_name": "VenusProtocol/venus-protocol-docs", "max_issues_repo_issues_event_min_datetime": "2021-11-19T06:50:06.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-19T06:50:06.000Z", "max_forks_repo_path": "src/components/Docs/Governance/GetCurrentVotes.js", "max_forks_repo_name": "VenusProtocol/venus-protocol-docs", "max_forks_repo_forks_event_min_datetime": "2021-04-29T13:11:12.000Z", "max_forks_repo_forks_event_max_datetime": "2021-10-17T00:24:32.000Z"}
{"max_stars_count": 2, "max_issues_count": 1, "max_forks_count": 5, "avg_line_length": 37.125, "max_line_length": 138, "alphanum_fraction": 0.6879910213}
import React from 'react';
import styled from 'styled-components';
import Label from 'components/Basic/Label';
import Description from 'components/Basic/Description';
import HighLighter from 'components/Basic/HighLighter';
import Parameter from 'components/Basic/Parameter';
import { SubSection, ParameterSection } from 'components/Basic/Section';

const GetCurrentVotesWrapper = styled.div`
  margin-bottom: 50px;
`;

function GetCurrentVotes() {
  const xvsFormula = `function getCurrentVotes(address account) returns (uint96)`;
  const solidityFormula = `XVS xvs = XVS(0x123...); // contract address\nxvs.getCurrentVotes(0xabc...);`;
  const web3Formula = `const account = '0x123...'; // contract address\nconst votes = await xvs.methods.getCurrentVotes(account).call();`;
  return (
    <GetCurrentVotesWrapper id="governance-get-current-votes">
      <Label title marginBottom>
        Get Current Votes
      </Label>
      <Description>
        Gets the balance of votes for an account as of the current block.
      </Description>
      <SubSection>
        <Label marginBottom>XVS</Label>
        <HighLighter>{xvsFormula}</HighLighter>
        <ParameterSection>
          <Parameter name="account">
            : Address of the account in which to retrieve the number of votes.
          </Parameter>
          <Parameter name="RETURN">: The number of votes (integer).</Parameter>
        </ParameterSection>
      </SubSection>
      <SubSection>
        <Label marginBottom>Solidity</Label>
        <HighLighter>{solidityFormula}</HighLighter>
      </SubSection>
      <SubSection>
        <Label marginBottom>Web3 1.2.6</Label>
        <HighLighter>{web3Formula}</HighLighter>
      </SubSection>
    </GetCurrentVotesWrapper>
  );
}

export default GetCurrentVotes;
