-
Notifications
You must be signed in to change notification settings - Fork 7
Create proxyOKLG.sol and edit supporting interface #33
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| //SPDX-License-Identifier: Unlicense | ||
| pragma solidity ^0.8.4; | ||
|
|
||
| import '@openzeppelin/contracts/token/ERC20/ERC20.sol'; | ||
| import './interfaces/IOKLGRewardDistributor.sol'; | ||
|
|
||
| contract proxyOKLG is ERC20 { | ||
| address public OKLGContract; | ||
| address public owner; | ||
| address public OKLGStakingContract; | ||
| bool public factorNFTBoost = false; | ||
|
|
||
| modifier onlyOwner() { | ||
|
Member
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. This is fine to specify the modifier, but we could use |
||
| require(msg.sender == owner, 'Only owner can call this function'); | ||
| _; | ||
| } | ||
|
|
||
| constructor(string memory name, string memory symbol) ERC20(name, symbol) { | ||
| owner = msg.sender; | ||
| } | ||
|
|
||
| function transfer(address recipient, uint256 amount) | ||
| public | ||
| override | ||
| returns (bool) | ||
| { | ||
| revert('This proxy token is not transferable'); | ||
| } | ||
|
|
||
| function balanceOf(address _account) public view override returns (uint256) { | ||
| uint256 _stakedBalance = factorNFTBoost | ||
| ? IOKLGRewardDistributor(OKLGStakingContract).getShares(_account) | ||
| : IOKLGRewardDistributor(OKLGStakingContract).getBaseShares(_account); | ||
| uint256 _balance = IERC20(OKLGContract).balanceOf(_account); | ||
| uint256 _totalBalance = _stakedBalance + _balance; | ||
|
|
||
| return _totalBalance; | ||
| } | ||
|
|
||
| function setOKLGContract(address _OKLGContract) external onlyOwner { | ||
| OKLGContract = _OKLGContract; | ||
| } | ||
|
|
||
| function setOKLGStakingContract(address _OKLGStakingContract) | ||
|
Member
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. nitpick, but let's keep parameters camel case instead of title case |
||
| external | ||
| onlyOwner | ||
| { | ||
| OKLGStakingContract = _OKLGStakingContract; | ||
| } | ||
|
|
||
| function setFactorNFTBoost(bool _factorNFTBoost) external onlyOwner { | ||
| factorNFTBoost = _factorNFTBoost; | ||
| } | ||
| } | ||
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.
Can we use the interface IERC20.sol here instead of the contract? will save on gas.