Skip to content

Commit

Permalink
refactor: External functions set to public
Browse files Browse the repository at this point in the history
  • Loading branch information
PacificYield committed Nov 7, 2024
1 parent 47579fa commit af186d7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions contracts/governance/Comp.sol
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ abstract contract Comp is IComp, EncryptedERC20, Ownable2Step {
/**
* @notice See {IComp-getPriorVotesForGovernor}.
*/
function getPriorVotesForGovernor(address account, uint256 blockNumber) external returns (euint64 votes) {
function getPriorVotesForGovernor(address account, uint256 blockNumber) public returns (euint64 votes) {
if (msg.sender != governor) {
revert GovernorInvalid();
}
Expand All @@ -140,7 +140,7 @@ abstract contract Comp is IComp, EncryptedERC20, Ownable2Step {
* @param account Account address
* @return votes Current (encrypted) votes.
*/
function getCurrentVotes(address account) external view returns (euint64 votes) {
function getCurrentVotes(address account) public view returns (euint64 votes) {
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints > 0) {
votes = _checkpoints[account][nCheckpoints - 1].votes;
Expand All @@ -154,7 +154,7 @@ abstract contract Comp is IComp, EncryptedERC20, Ownable2Step {
* @param blockNumber The block number to get the vote balance at.
* @return votes Number of votes the account as of the given block.
*/
function getPriorVotes(address account, uint256 blockNumber) external view returns (euint64 votes) {
function getPriorVotes(address account, uint256 blockNumber) public view returns (euint64 votes) {
if (blockNumber >= block.number) {
revert BlockNumberEqualOrHigherThanCurrentBlock();
}
Expand Down
28 changes: 14 additions & 14 deletions contracts/governance/GovernorAlphaZama.sol
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ abstract contract GovernorAlphaZama is Ownable2Step, GatewayCaller {
* In the original GovernorAlpha, the proposer can cancel only if
* her votes are still above the threshold.
*/
function cancel(uint256 proposalId) external {
function cancel(uint256 proposalId) public {
Proposal memory proposal = _proposals[proposalId];

if (
Expand Down Expand Up @@ -305,16 +305,16 @@ abstract contract GovernorAlphaZama is Ownable2Step, GatewayCaller {
* @param value Encrypted value.
* @param inputProof Input proof.
*/
function castVote(uint256 proposalId, einput value, bytes calldata inputProof) external {
return _castVote(msg.sender, proposalId, TFHE.asEbool(value, inputProof));
function castVote(uint256 proposalId, einput value, bytes calldata inputProof) public {
return castVote(proposalId, TFHE.asEbool(value, inputProof));
}

/**
* @notice Cast a vote.
* @param proposalId Proposal id.
* @param support Support (true ==> votesFor, false ==> votesAgainst)
*/
function castVote(uint256 proposalId, ebool support) external {
function castVote(uint256 proposalId, ebool support) public {
return _castVote(msg.sender, proposalId, support);
}

Expand All @@ -323,7 +323,7 @@ abstract contract GovernorAlphaZama is Ownable2Step, GatewayCaller {
* @dev Anyone can execute a proposal once it has been queued and the
* delay in the timelock is sufficient.
*/
function execute(uint256 proposalId) external payable {
function execute(uint256 proposalId) public payable {
Proposal memory proposal = _proposals[proposalId];

if (proposal.state != ProposalState.Queued) {
Expand Down Expand Up @@ -361,7 +361,7 @@ abstract contract GovernorAlphaZama is Ownable2Step, GatewayCaller {
string[] memory signatures,
bytes[] memory calldatas,
string memory description
) external returns (uint256 proposalId) {
) public returns (uint256 proposalId) {
{
uint256 length = targets.length;

Expand Down Expand Up @@ -454,7 +454,7 @@ abstract contract GovernorAlphaZama is Ownable2Step, GatewayCaller {
* @dev It can be done only if the proposal is adopted.
* @param proposalId Proposal id.
*/
function queue(uint256 proposalId) external {
function queue(uint256 proposalId) public {
Proposal memory proposal = _proposals[proposalId];

if (proposal.state != ProposalState.Succeeded) {
Expand All @@ -477,7 +477,7 @@ abstract contract GovernorAlphaZama is Ownable2Step, GatewayCaller {
* @notice Request the vote results to be decrypted.
* @param proposalId Proposal id.
*/
function requestVoteDecryption(uint256 proposalId) external {
function requestVoteDecryption(uint256 proposalId) public {
if (_proposals[proposalId].state != ProposalState.Active) {
revert ProposalStateInvalid();
}
Expand Down Expand Up @@ -547,7 +547,7 @@ abstract contract GovernorAlphaZama is Ownable2Step, GatewayCaller {
/**
* @dev Only callable by `owner`.
*/
function acceptTimelockAdmin() external onlyOwner {
function acceptTimelockAdmin() public onlyOwner {
TIMELOCK.acceptAdmin();
}

Expand All @@ -556,7 +556,7 @@ abstract contract GovernorAlphaZama is Ownable2Step, GatewayCaller {
* @param newPendingAdmin Address of the new pending admin for the timelock.
* @param eta Eta for executing the transaction in the timelock.
*/
function executeSetTimelockPendingAdmin(address newPendingAdmin, uint256 eta) external onlyOwner {
function executeSetTimelockPendingAdmin(address newPendingAdmin, uint256 eta) public onlyOwner {
TIMELOCK.executeTransaction(address(TIMELOCK), 0, "setPendingAdmin(address)", abi.encode(newPendingAdmin), eta);
}

Expand All @@ -565,7 +565,7 @@ abstract contract GovernorAlphaZama is Ownable2Step, GatewayCaller {
* @param newPendingAdmin Address of the new pending admin for the timelock.
* @param eta Eta for queuing the transaction in the timelock.
*/
function queueSetTimelockPendingAdmin(address newPendingAdmin, uint256 eta) external onlyOwner {
function queueSetTimelockPendingAdmin(address newPendingAdmin, uint256 eta) public onlyOwner {
TIMELOCK.queueTransaction(address(TIMELOCK), 0, "setPendingAdmin(address)", abi.encode(newPendingAdmin), eta);
}

Expand All @@ -576,7 +576,7 @@ abstract contract GovernorAlphaZama is Ownable2Step, GatewayCaller {
* @param proposalId Proposal id.
* @return proposalInfo Proposal information.
*/
function getProposalInfo(uint256 proposalId) external view returns (ProposalInfo memory proposalInfo) {
function getProposalInfo(uint256 proposalId) public view returns (ProposalInfo memory proposalInfo) {
Proposal memory proposal = _proposals[proposalId];
proposalInfo.proposer = proposal.proposer;
proposalInfo.state = proposal.state;
Expand Down Expand Up @@ -607,7 +607,7 @@ abstract contract GovernorAlphaZama is Ownable2Step, GatewayCaller {
* @return support The support for the account (true ==> vote for, false ==> vote against).
* @return votes The number of votes cast.
*/
function getReceipt(uint256 proposalId, address account) external view returns (bool, ebool, euint64) {
function getReceipt(uint256 proposalId, address account) public view returns (bool, ebool, euint64) {
Receipt memory receipt = _accountReceiptForProposalId[proposalId][account];
return (receipt.hasVoted, receipt.support, receipt.votes);
}
Expand All @@ -626,7 +626,7 @@ abstract contract GovernorAlphaZama is Ownable2Step, GatewayCaller {
TIMELOCK.queueTransaction(target, value, signature, data, eta);
}

function _castVote(address voter, uint256 proposalId, ebool support) internal {
function _castVote(address voter, uint256 proposalId, ebool support) private {
Proposal storage proposal = _proposals[proposalId];

if (proposal.state != ProposalState.Active) {
Expand Down

0 comments on commit af186d7

Please sign in to comment.