Skip to content

Commit

Permalink
rename to BTRST
Browse files Browse the repository at this point in the history
  • Loading branch information
musnit committed Aug 10, 2021
1 parent 5a423ec commit 14ff54f
Show file tree
Hide file tree
Showing 25 changed files with 10,077 additions and 14,529 deletions.
10 changes: 8 additions & 2 deletions btrust.config.js → btrst.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ module.exports = {
proposalThreshold: '500',
votingPeriod: '17280',
timelockPeriod: 7 * 24 * 60 * 60
},
mainnet: {
quorumVotes: '100000',
proposalThreshold: '500',
votingPeriod: '17280',
timelockPeriod: 7 * 24 * 60 * 60
}
}
};
}
};
20 changes: 10 additions & 10 deletions contracts/GovernorAlpha.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma experimental ABIEncoderV2;

contract GovernorAlpha {
/// @notice The name of this contract
string public constant name = "BTRUST Governor Alpha";
string public constant name = "BTRST Governor Alpha";

/// @notice The number of votes required in order for a voter to become a proposer
uint private _proposalThreshold;
Expand All @@ -22,11 +22,11 @@ contract GovernorAlpha {

/// @notice The duration of voting on a proposal, in blocks

/// @notice The address of the BTRUST Protocol Timelock
/// @notice The address of the BTRST Protocol Timelock
TimelockInterface public timelock;

/// @notice The address of the BTRUST governance token
BTRUSTInterface public BTRUST;
/// @notice The address of the BTRST governance token
BTRSTInterface public BTRST;

/// @notice The address of the Governor Guardian
address public guardian;
Expand Down Expand Up @@ -129,9 +129,9 @@ contract GovernorAlpha {
/// @notice An event emitted when a proposal has been executed in the Timelock
event ProposalExecuted(uint id);

constructor(address timelock_, address BTRUST_, address guardian_, uint quorumVotes_, uint proposalThreshold_, uint32 votingPeriod_) public {
constructor(address timelock_, address BTRST_, address guardian_, uint quorumVotes_, uint proposalThreshold_, uint32 votingPeriod_) public {
timelock = TimelockInterface(timelock_);
BTRUST = BTRUSTInterface(BTRUST_);
BTRST = BTRSTInterface(BTRST_);
guardian = guardian_;
_quorumVotes = quorumVotes_;
_proposalThreshold = proposalThreshold_;
Expand All @@ -145,7 +145,7 @@ contract GovernorAlpha {
function votingPeriod() public view returns (uint) { return _votingPeriod; }

function propose(address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas, string memory description) public returns (uint) {
require(BTRUST.getPriorVotes(msg.sender, sub256(block.number, 1)) > proposalThreshold(), "GovernorAlpha::propose: proposer votes below proposal threshold");
require(BTRST.getPriorVotes(msg.sender, sub256(block.number, 1)) > proposalThreshold(), "GovernorAlpha::propose: proposer votes below proposal threshold");
require(targets.length == values.length && targets.length == signatures.length && targets.length == calldatas.length, "GovernorAlpha::propose: proposal function information arity mismatch");
require(targets.length != 0, "GovernorAlpha::propose: must provide actions");
require(targets.length <= proposalMaxOperations(), "GovernorAlpha::propose: too many actions");
Expand Down Expand Up @@ -215,7 +215,7 @@ contract GovernorAlpha {
require(state != ProposalState.Executed, "GovernorAlpha::cancel: cannot cancel executed proposal");

Proposal storage proposal = proposals[proposalId];
require(msg.sender == guardian || BTRUST.getPriorVotes(proposal.proposer, sub256(block.number, 1)) < proposalThreshold(), "GovernorAlpha::cancel: proposer above threshold");
require(msg.sender == guardian || BTRST.getPriorVotes(proposal.proposer, sub256(block.number, 1)) < proposalThreshold(), "GovernorAlpha::cancel: proposer above threshold");

proposal.canceled = true;
for (uint i = 0; i < proposal.targets.length; i++) {
Expand Down Expand Up @@ -274,7 +274,7 @@ contract GovernorAlpha {
Proposal storage proposal = proposals[proposalId];
Receipt storage receipt = proposal.receipts[voter];
require(receipt.hasVoted == false, "GovernorAlpha::_castVote: voter already voted");
uint96 votes = BTRUST.getPriorVotes(voter, proposal.startBlock);
uint96 votes = BTRST.getPriorVotes(voter, proposal.startBlock);

if (support) {
proposal.forVotes = add256(proposal.forVotes, votes);
Expand Down Expand Up @@ -337,6 +337,6 @@ interface TimelockInterface {
function executeTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external payable returns (bytes memory);
}

interface BTRUSTInterface {
interface BTRSTInterface {
function getPriorVotes(address account, uint blockNumber) external view returns (uint96);
}
12 changes: 6 additions & 6 deletions deploy/01_deploy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const btrustConfig = require('../btrust.config.js');
const { networks: { ropsten: { timelockPeriod, quorumVotes, proposalThreshold, votingPeriod } } } = btrustConfig
const btrstConfig = require('../btrst.config.js');
const { networks: { ropsten: { timelockPeriod, quorumVotes, proposalThreshold, votingPeriod } } } = btrstConfig

module.exports = async ({
getNamedAccounts,
Expand All @@ -13,12 +13,12 @@ module.exports = async ({
// PLEASE DON'T CHANGE ORDER OF DEPLOYMNET"

console.log("----------------------------------------------------");
console.log(`Deploying BTRUST with: { deployer: ${deployer}, foundationInitialAddress: ${foundationInitialAddress} }}`);
const btrust = await deploy('BTRUST', {
console.log(`Deploying BTRST with: { deployer: ${deployer}, foundationInitialAddress: ${foundationInitialAddress} }}`);
const btrst = await deploy('BTRST', {
from: deployer,
args: [foundationInitialAddress],
});
console.log("BTRUST deployed to: ", btrust.address);
console.log("BTRST deployed to: ", btrst.address);


console.log("----------------------------------------------------");
Expand All @@ -33,7 +33,7 @@ module.exports = async ({
console.log('Deploying GovernorAlpha');
const governorAlpha = await deploy('GovernorAlpha', {
from: deployer,
args: [timelock.address, btrust.address, foundationInitialAddress, web3.utils.toWei(quorumVotes), web3.utils.toWei(proposalThreshold), votingPeriod],
args: [timelock.address, btrst.address, foundationInitialAddress, web3.utils.toWei(quorumVotes), web3.utils.toWei(proposalThreshold), votingPeriod],
});
console.log("GovernorAlpha deployed to: ", governorAlpha.address);
if (governorAlpha.address !== governorAlphaAddress) {
Expand Down
1 change: 0 additions & 1 deletion deployments/mainnet/.chainId

This file was deleted.

Loading

0 comments on commit 14ff54f

Please sign in to comment.