@@ -3,18 +3,18 @@ pragma experimental ABIEncoderV2;
3
3
4
4
import "./SafeMath.sol " ;
5
5
6
- contract Uni {
6
+ contract Forth {
7
7
/// @notice EIP-20 token name for this token
8
- string public constant name = "Uniswap " ;
8
+ string public constant name = "Ampleforth Governance " ;
9
9
10
10
/// @notice EIP-20 token symbol for this token
11
- string public constant symbol = "UNI " ;
11
+ string public constant symbol = "FORTH " ;
12
12
13
13
/// @notice EIP-20 token decimals for this token
14
14
uint8 public constant decimals = 18 ;
15
15
16
16
/// @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
18
18
19
19
/// @notice Address which may mint new tokens
20
20
address public minter;
@@ -77,13 +77,13 @@ contract Uni {
77
77
event Approval (address indexed owner , address indexed spender , uint256 amount );
78
78
79
79
/**
80
- * @notice Construct a new Uni token
80
+ * @notice Construct a new Forth token
81
81
* @param account The initial account to grant all the tokens
82
82
* @param minter_ The account with minting ability
83
83
* @param mintingAllowedAfter_ The timestamp after which minting may occur
84
84
*/
85
85
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 " );
87
87
88
88
balances[account] = uint96 (totalSupply);
89
89
emit Transfer (address (0 ), account, totalSupply);
@@ -97,7 +97,7 @@ contract Uni {
97
97
* @param minter_ The address of the new minter
98
98
*/
99
99
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 " );
101
101
emit MinterChanged (minter, minter_);
102
102
minter = minter_;
103
103
}
@@ -108,20 +108,20 @@ contract Uni {
108
108
* @param rawAmount The number of tokens to be minted
109
109
*/
110
110
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 " );
114
114
115
115
// record the mint
116
116
mintingAllowedAfter = SafeMath.add (block .timestamp , minimumTimeBetweenMints);
117
117
118
118
// 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 " );
122
122
123
123
// 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 " );
125
125
emit Transfer (address (0 ), dst, amount);
126
126
127
127
// move delegates
@@ -151,7 +151,7 @@ contract Uni {
151
151
if (rawAmount == uint (- 1 )) {
152
152
amount = uint96 (- 1 );
153
153
} else {
154
- amount = safe96 (rawAmount, "Uni ::approve: amount exceeds 96 bits " );
154
+ amount = safe96 (rawAmount, "Forth ::approve: amount exceeds 96 bits " );
155
155
}
156
156
157
157
allowances[msg .sender ][spender] = amount;
@@ -175,16 +175,16 @@ contract Uni {
175
175
if (rawAmount == uint (- 1 )) {
176
176
amount = uint96 (- 1 );
177
177
} else {
178
- amount = safe96 (rawAmount, "Uni ::permit: amount exceeds 96 bits " );
178
+ amount = safe96 (rawAmount, "Forth ::permit: amount exceeds 96 bits " );
179
179
}
180
180
181
181
bytes32 domainSeparator = keccak256 (abi.encode (DOMAIN_TYPEHASH, keccak256 (bytes (name)), getChainId (), address (this )));
182
182
bytes32 structHash = keccak256 (abi.encode (PERMIT_TYPEHASH, owner, spender, rawAmount, nonces[owner]++ , deadline));
183
183
bytes32 digest = keccak256 (abi.encodePacked ("\x19\x01 " , domainSeparator, structHash));
184
184
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 " );
188
188
189
189
allowances[owner][spender] = amount;
190
190
@@ -207,7 +207,7 @@ contract Uni {
207
207
* @return Whether or not the transfer succeeded
208
208
*/
209
209
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 " );
211
211
_transferTokens (msg .sender , dst, amount);
212
212
return true ;
213
213
}
@@ -222,10 +222,10 @@ contract Uni {
222
222
function transferFrom (address src , address dst , uint rawAmount ) external returns (bool ) {
223
223
address spender = msg .sender ;
224
224
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 " );
226
226
227
227
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 " );
229
229
allowances[src][spender] = newAllowance;
230
230
231
231
emit Approval (src, spender, newAllowance);
@@ -257,9 +257,9 @@ contract Uni {
257
257
bytes32 structHash = keccak256 (abi.encode (DELEGATION_TYPEHASH, delegatee, nonce, expiry));
258
258
bytes32 digest = keccak256 (abi.encodePacked ("\x19\x01 " , domainSeparator, structHash));
259
259
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 " );
263
263
return _delegate (signatory, delegatee);
264
264
}
265
265
@@ -281,7 +281,7 @@ contract Uni {
281
281
* @return The number of votes the account had as of the given block
282
282
*/
283
283
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 " );
285
285
286
286
uint32 nCheckpoints = numCheckpoints[account];
287
287
if (nCheckpoints == 0 ) {
@@ -325,11 +325,11 @@ contract Uni {
325
325
}
326
326
327
327
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 " );
330
330
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 " );
333
333
emit Transfer (src, dst, amount);
334
334
335
335
_moveDelegates (delegates[src], delegates[dst], amount);
@@ -340,21 +340,21 @@ contract Uni {
340
340
if (srcRep != address (0 )) {
341
341
uint32 srcRepNum = numCheckpoints[srcRep];
342
342
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 " );
344
344
_writeCheckpoint (srcRep, srcRepNum, srcRepOld, srcRepNew);
345
345
}
346
346
347
347
if (dstRep != address (0 )) {
348
348
uint32 dstRepNum = numCheckpoints[dstRep];
349
349
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 " );
351
351
_writeCheckpoint (dstRep, dstRepNum, dstRepOld, dstRepNew);
352
352
}
353
353
}
354
354
}
355
355
356
356
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 " );
358
358
359
359
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1 ].fromBlock == blockNumber) {
360
360
checkpoints[delegatee][nCheckpoints - 1 ].votes = newVotes;
@@ -392,4 +392,4 @@ contract Uni {
392
392
assembly { chainId := chainid () }
393
393
return chainId;
394
394
}
395
- }
395
+ }
0 commit comments