Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions contracts/interfaces/IOKLGRewardDistributor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ interface IOKLGRewardDistributor {

function getShares(address wallet) external view returns (uint256);

function getBaseShares(address wallet) external view returns (uint256);

function getBoostNfts(address wallet)
external
view
Expand Down
54 changes: 54 additions & 0 deletions contracts/unaudited/proxyOKLG.sol
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';
Copy link
Member

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.

import './interfaces/IOKLGRewardDistributor.sol';

contract proxyOKLG is ERC20 {
address public OKLGContract;
address public owner;
address public OKLGStakingContract;
bool public factorNFTBoost = false;

modifier onlyOwner() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine to specify the modifier, but we could use Ownable.sol as well to support the other functions like transferOwnership among other things in the future if need be.

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)
Copy link
Member

@whatl3y whatl3y Apr 18, 2022

Choose a reason for hiding this comment

The 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;
}
}