Skip to content

Commit 9fa7fa9

Browse files
author
Brandon Iles
committed
Rename strings
1 parent 087d631 commit 9fa7fa9

File tree

7 files changed

+95
-101
lines changed

7 files changed

+95
-101
lines changed

contracts/Forth.sol

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ pragma experimental ABIEncoderV2;
33

44
import "./SafeMath.sol";
55

6-
contract Uni {
6+
contract Forth {
77
/// @notice EIP-20 token name for this token
8-
string public constant name = "Uniswap";
8+
string public constant name = "Ampleforth Governance";
99

1010
/// @notice EIP-20 token symbol for this token
11-
string public constant symbol = "UNI";
11+
string public constant symbol = "FORTH";
1212

1313
/// @notice EIP-20 token decimals for this token
1414
uint8 public constant decimals = 18;
1515

1616
/// @notice Total number of tokens in circulation
17-
uint public totalSupply = 1_000_000_000e18; // 1 billion Uni
17+
uint public totalSupply = 15_000_000e18; // 15 million Forth
1818

1919
/// @notice Address which may mint new tokens
2020
address public minter;
@@ -77,13 +77,13 @@ contract Uni {
7777
event Approval(address indexed owner, address indexed spender, uint256 amount);
7878

7979
/**
80-
* @notice Construct a new Uni token
80+
* @notice Construct a new Forth token
8181
* @param account The initial account to grant all the tokens
8282
* @param minter_ The account with minting ability
8383
* @param mintingAllowedAfter_ The timestamp after which minting may occur
8484
*/
8585
constructor(address account, address minter_, uint mintingAllowedAfter_) public {
86-
require(mintingAllowedAfter_ >= block.timestamp, "Uni::constructor: minting can only begin after deployment");
86+
require(mintingAllowedAfter_ >= block.timestamp, "Forth::constructor: minting can only begin after deployment");
8787

8888
balances[account] = uint96(totalSupply);
8989
emit Transfer(address(0), account, totalSupply);
@@ -97,7 +97,7 @@ contract Uni {
9797
* @param minter_ The address of the new minter
9898
*/
9999
function setMinter(address minter_) external {
100-
require(msg.sender == minter, "Uni::setMinter: only the minter can change the minter address");
100+
require(msg.sender == minter, "Forth::setMinter: only the minter can change the minter address");
101101
emit MinterChanged(minter, minter_);
102102
minter = minter_;
103103
}
@@ -108,20 +108,20 @@ contract Uni {
108108
* @param rawAmount The number of tokens to be minted
109109
*/
110110
function mint(address dst, uint rawAmount) external {
111-
require(msg.sender == minter, "Uni::mint: only the minter can mint");
112-
require(block.timestamp >= mintingAllowedAfter, "Uni::mint: minting not allowed yet");
113-
require(dst != address(0), "Uni::mint: cannot transfer to the zero address");
111+
require(msg.sender == minter, "Forth::mint: only the minter can mint");
112+
require(block.timestamp >= mintingAllowedAfter, "Forth::mint: minting not allowed yet");
113+
require(dst != address(0), "Forth::mint: cannot transfer to the zero address");
114114

115115
// record the mint
116116
mintingAllowedAfter = SafeMath.add(block.timestamp, minimumTimeBetweenMints);
117117

118118
// mint the amount
119-
uint96 amount = safe96(rawAmount, "Uni::mint: amount exceeds 96 bits");
120-
require(amount <= SafeMath.div(SafeMath.mul(totalSupply, mintCap), 100), "Uni::mint: exceeded mint cap");
121-
totalSupply = safe96(SafeMath.add(totalSupply, amount), "Uni::mint: totalSupply exceeds 96 bits");
119+
uint96 amount = safe96(rawAmount, "Forth::mint: amount exceeds 96 bits");
120+
require(amount <= SafeMath.div(SafeMath.mul(totalSupply, mintCap), 100), "Forth::mint: exceeded mint cap");
121+
totalSupply = safe96(SafeMath.add(totalSupply, amount), "Forth::mint: totalSupply exceeds 96 bits");
122122

123123
// transfer the amount to the recipient
124-
balances[dst] = add96(balances[dst], amount, "Uni::mint: transfer amount overflows");
124+
balances[dst] = add96(balances[dst], amount, "Forth::mint: transfer amount overflows");
125125
emit Transfer(address(0), dst, amount);
126126

127127
// move delegates
@@ -151,7 +151,7 @@ contract Uni {
151151
if (rawAmount == uint(-1)) {
152152
amount = uint96(-1);
153153
} else {
154-
amount = safe96(rawAmount, "Uni::approve: amount exceeds 96 bits");
154+
amount = safe96(rawAmount, "Forth::approve: amount exceeds 96 bits");
155155
}
156156

157157
allowances[msg.sender][spender] = amount;
@@ -175,16 +175,16 @@ contract Uni {
175175
if (rawAmount == uint(-1)) {
176176
amount = uint96(-1);
177177
} else {
178-
amount = safe96(rawAmount, "Uni::permit: amount exceeds 96 bits");
178+
amount = safe96(rawAmount, "Forth::permit: amount exceeds 96 bits");
179179
}
180180

181181
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
182182
bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, rawAmount, nonces[owner]++, deadline));
183183
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
184184
address signatory = ecrecover(digest, v, r, s);
185-
require(signatory != address(0), "Uni::permit: invalid signature");
186-
require(signatory == owner, "Uni::permit: unauthorized");
187-
require(now <= deadline, "Uni::permit: signature expired");
185+
require(signatory != address(0), "Forth::permit: invalid signature");
186+
require(signatory == owner, "Forth::permit: unauthorized");
187+
require(now <= deadline, "Forth::permit: signature expired");
188188

189189
allowances[owner][spender] = amount;
190190

@@ -207,7 +207,7 @@ contract Uni {
207207
* @return Whether or not the transfer succeeded
208208
*/
209209
function transfer(address dst, uint rawAmount) external returns (bool) {
210-
uint96 amount = safe96(rawAmount, "Uni::transfer: amount exceeds 96 bits");
210+
uint96 amount = safe96(rawAmount, "Forth::transfer: amount exceeds 96 bits");
211211
_transferTokens(msg.sender, dst, amount);
212212
return true;
213213
}
@@ -222,10 +222,10 @@ contract Uni {
222222
function transferFrom(address src, address dst, uint rawAmount) external returns (bool) {
223223
address spender = msg.sender;
224224
uint96 spenderAllowance = allowances[src][spender];
225-
uint96 amount = safe96(rawAmount, "Uni::approve: amount exceeds 96 bits");
225+
uint96 amount = safe96(rawAmount, "Forth::approve: amount exceeds 96 bits");
226226

227227
if (spender != src && spenderAllowance != uint96(-1)) {
228-
uint96 newAllowance = sub96(spenderAllowance, amount, "Uni::transferFrom: transfer amount exceeds spender allowance");
228+
uint96 newAllowance = sub96(spenderAllowance, amount, "Forth::transferFrom: transfer amount exceeds spender allowance");
229229
allowances[src][spender] = newAllowance;
230230

231231
emit Approval(src, spender, newAllowance);
@@ -257,9 +257,9 @@ contract Uni {
257257
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
258258
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
259259
address signatory = ecrecover(digest, v, r, s);
260-
require(signatory != address(0), "Uni::delegateBySig: invalid signature");
261-
require(nonce == nonces[signatory]++, "Uni::delegateBySig: invalid nonce");
262-
require(now <= expiry, "Uni::delegateBySig: signature expired");
260+
require(signatory != address(0), "Forth::delegateBySig: invalid signature");
261+
require(nonce == nonces[signatory]++, "Forth::delegateBySig: invalid nonce");
262+
require(now <= expiry, "Forth::delegateBySig: signature expired");
263263
return _delegate(signatory, delegatee);
264264
}
265265

@@ -281,7 +281,7 @@ contract Uni {
281281
* @return The number of votes the account had as of the given block
282282
*/
283283
function getPriorVotes(address account, uint blockNumber) public view returns (uint96) {
284-
require(blockNumber < block.number, "Uni::getPriorVotes: not yet determined");
284+
require(blockNumber < block.number, "Forth::getPriorVotes: not yet determined");
285285

286286
uint32 nCheckpoints = numCheckpoints[account];
287287
if (nCheckpoints == 0) {
@@ -325,11 +325,11 @@ contract Uni {
325325
}
326326

327327
function _transferTokens(address src, address dst, uint96 amount) internal {
328-
require(src != address(0), "Uni::_transferTokens: cannot transfer from the zero address");
329-
require(dst != address(0), "Uni::_transferTokens: cannot transfer to the zero address");
328+
require(src != address(0), "Forth::_transferTokens: cannot transfer from the zero address");
329+
require(dst != address(0), "Forth::_transferTokens: cannot transfer to the zero address");
330330

331-
balances[src] = sub96(balances[src], amount, "Uni::_transferTokens: transfer amount exceeds balance");
332-
balances[dst] = add96(balances[dst], amount, "Uni::_transferTokens: transfer amount overflows");
331+
balances[src] = sub96(balances[src], amount, "Forth::_transferTokens: transfer amount exceeds balance");
332+
balances[dst] = add96(balances[dst], amount, "Forth::_transferTokens: transfer amount overflows");
333333
emit Transfer(src, dst, amount);
334334

335335
_moveDelegates(delegates[src], delegates[dst], amount);
@@ -340,21 +340,21 @@ contract Uni {
340340
if (srcRep != address(0)) {
341341
uint32 srcRepNum = numCheckpoints[srcRep];
342342
uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
343-
uint96 srcRepNew = sub96(srcRepOld, amount, "Uni::_moveVotes: vote amount underflows");
343+
uint96 srcRepNew = sub96(srcRepOld, amount, "Forth::_moveVotes: vote amount underflows");
344344
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
345345
}
346346

347347
if (dstRep != address(0)) {
348348
uint32 dstRepNum = numCheckpoints[dstRep];
349349
uint96 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
350-
uint96 dstRepNew = add96(dstRepOld, amount, "Uni::_moveVotes: vote amount overflows");
350+
uint96 dstRepNew = add96(dstRepOld, amount, "Forth::_moveVotes: vote amount overflows");
351351
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
352352
}
353353
}
354354
}
355355

356356
function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint96 oldVotes, uint96 newVotes) internal {
357-
uint32 blockNumber = safe32(block.number, "Uni::_writeCheckpoint: block number exceeds 32 bits");
357+
uint32 blockNumber = safe32(block.number, "Forth::_writeCheckpoint: block number exceeds 32 bits");
358358

359359
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
360360
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
@@ -392,4 +392,4 @@ contract Uni {
392392
assembly { chainId := chainid() }
393393
return chainId;
394394
}
395-
}
395+
}

contracts/GovernorAlpha.sol

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ pragma experimental ABIEncoderV2;
33

44
contract GovernorAlpha {
55
/// @notice The name of this contract
6-
string public constant name = "Uniswap Governor Alpha";
6+
string public constant name = "Ampleforth Governor Alpha";
77

88
/// @notice The number of votes in support of a proposal required in order for a quorum to be reached and for a vote to succeed
9-
function quorumVotes() public pure returns (uint) { return 40_000_000e18; } // 4% of Uni
9+
function quorumVotes() public pure returns (uint) { return 40_000_000e18; } // 4% of Forth
1010

1111
/// @notice The number of votes required in order for a voter to become a proposer
12-
function proposalThreshold() public pure returns (uint) { return 10_000_000e18; } // 1% of Uni
12+
function proposalThreshold() public pure returns (uint) { return 10_000_000e18; } // 1% of Forth
1313

1414
/// @notice The maximum number of actions that can be included in a proposal
1515
function proposalMaxOperations() public pure returns (uint) { return 10; } // 10 actions
@@ -20,11 +20,11 @@ contract GovernorAlpha {
2020
/// @notice The duration of voting on a proposal, in blocks
2121
function votingPeriod() public pure returns (uint) { return 40_320; } // ~7 days in blocks (assuming 15s blocks)
2222

23-
/// @notice The address of the Uniswap Protocol Timelock
23+
/// @notice The address of the Ampleforth Protocol Timelock
2424
TimelockInterface public timelock;
2525

26-
/// @notice The address of the Uniswap governance token
27-
UniInterface public uni;
26+
/// @notice The address of the Ampleforth governance token
27+
ForthInterface public forth;
2828

2929
/// @notice The total number of proposals
3030
uint public proposalCount;
@@ -124,13 +124,13 @@ contract GovernorAlpha {
124124
/// @notice An event emitted when a proposal has been executed in the Timelock
125125
event ProposalExecuted(uint id);
126126

127-
constructor(address timelock_, address uni_) public {
127+
constructor(address timelock_, address forth_) public {
128128
timelock = TimelockInterface(timelock_);
129-
uni = UniInterface(uni_);
129+
forth = ForthInterface(forth_);
130130
}
131131

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

202202
Proposal storage proposal = proposals[proposalId];
203-
require(uni.getPriorVotes(proposal.proposer, sub256(block.number, 1)) < proposalThreshold(), "GovernorAlpha::cancel: proposer above threshold");
203+
require(forth.getPriorVotes(proposal.proposer, sub256(block.number, 1)) < proposalThreshold(), "GovernorAlpha::cancel: proposer above threshold");
204204

205205
proposal.canceled = true;
206206
for (uint i = 0; i < proposal.targets.length; i++) {
@@ -259,7 +259,7 @@ contract GovernorAlpha {
259259
Proposal storage proposal = proposals[proposalId];
260260
Receipt storage receipt = proposal.receipts[voter];
261261
require(receipt.hasVoted == false, "GovernorAlpha::_castVote: voter already voted");
262-
uint96 votes = uni.getPriorVotes(voter, proposal.startBlock);
262+
uint96 votes = forth.getPriorVotes(voter, proposal.startBlock);
263263

264264
if (support) {
265265
proposal.forVotes = add256(proposal.forVotes, votes);
@@ -302,6 +302,6 @@ interface TimelockInterface {
302302
function executeTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external payable returns (bytes memory);
303303
}
304304

305-
interface UniInterface {
305+
interface ForthInterface {
306306
function getPriorVotes(address account, uint blockNumber) external view returns (uint96);
307-
}
307+
}

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "@uniswap/governance",
3-
"version": "1.0.2",
4-
"description": "🏛 Governance contracts for the Uniswap protocol",
5-
"author": "Noah Zinsmeister",
2+
"name": "@ampleforth/Forth-v2",
3+
"version": "1.0.0",
4+
"description": "🏛 Governance contracts for the Ampleforth protocol",
5+
"author": "Brandon Iles",
66
"license": "MIT",
77
"files": [
88
"build"
@@ -18,7 +18,6 @@
1818
"devDependencies": {
1919
"@types/chai": "^4.2.12",
2020
"@types/mocha": "^8.0.3",
21-
"@uniswap/v2-core": "^1.0.1",
2221
"chai": "^4.2.0",
2322
"ethereum-waffle": "^3.1.0",
2423
"ethereumjs-util": "^7.0.4",

0 commit comments

Comments
 (0)