-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
erc20 proxy deploy #115
erc20 proxy deploy #115
Changes from all commits
994939b
521ae0c
d3bc98a
df2198e
f10b6b5
ab249c2
aa247ec
c04070c
fa76d8a
c6bac08
3709448
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,10 +8,30 @@ import {IJBToken} from "./interfaces/IJBToken.sol"; | |
|
||
/// @notice An ERC-20 token that can be used by a project in the `JBTokens`. | ||
contract JBERC20 is ERC20Votes, ERC20Permit, Ownable, IJBToken { | ||
//*********************************************************************// | ||
// --------------------- internal stored properties ------------------ // | ||
//*********************************************************************// | ||
|
||
/// @notice The token's name. | ||
string private _name; | ||
|
||
/// @notice The token's symbol. | ||
string private _symbol; | ||
|
||
//*********************************************************************// | ||
// -------------------------- public views --------------------------- // | ||
//*********************************************************************// | ||
|
||
/// @notice The token's name. | ||
function name() public view virtual override returns (string memory) { | ||
return _name; | ||
} | ||
|
||
/// @notice The token's symbol. | ||
function symbol() public view virtual override returns (string memory) { | ||
return _symbol; | ||
} | ||
|
||
/// @notice The number of decimals included in the fixed point accounting of this token. | ||
/// @return The number of decimals. | ||
function decimals() public view override(ERC20, IJBToken) returns (uint8) { | ||
|
@@ -35,18 +55,7 @@ contract JBERC20 is ERC20Votes, ERC20Permit, Ownable, IJBToken { | |
// -------------------------- constructor ---------------------------- // | ||
//*********************************************************************// | ||
|
||
/// @param name The name of the token. | ||
/// @param symbol The symbol that the token should be represented by. | ||
/// @param owner The owner of the token. | ||
constructor( | ||
string memory name, | ||
string memory symbol, | ||
address owner | ||
) | ||
ERC20(name, symbol) | ||
ERC20Permit(name) | ||
Ownable(owner) | ||
{} | ||
constructor() Ownable(address(this)) ERC20("invalid", "invalid") ERC20Permit("JBToken") {} | ||
|
||
//*********************************************************************// | ||
// ---------------------- external transactions ---------------------- // | ||
|
@@ -68,6 +77,26 @@ contract JBERC20 is ERC20Votes, ERC20Permit, Ownable, IJBToken { | |
return _burn(account, amount); | ||
} | ||
|
||
//*********************************************************************// | ||
// ----------------------- public transactions ----------------------- // | ||
//*********************************************************************// | ||
|
||
/// @notice Initialized the token. | ||
/// @param name_ The name of the token. | ||
/// @param symbol_ The symbol that the token should be represented by. | ||
/// @param owner The owner of the token. | ||
function initialize(string memory name_, string memory symbol_, address owner) public override { | ||
// Stop re-initialization by preventing setting a name if one already exists, and making sure a non-empty name | ||
// is provided when initializing. | ||
if (bytes(_name).length != 0 || bytes(name_).length == 0) revert(); | ||
|
||
_name = name_; | ||
_symbol = symbol_; | ||
|
||
// Transfer ownership to the initializer. | ||
_transferOwnership(owner); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the purpose of transferring to an external owner besides JBTokens? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. none ever. should always be JBTokens, but JBTokens will always send itself. |
||
} | ||
|
||
/// @notice required override. | ||
function nonces(address owner) public view virtual override(ERC20Permit, Nonces) returns (uint256) { | ||
return super.nonces(owner); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fine but had to read it twice before understanding it :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm good feedback. how might we improve