Skip to content

Commit

Permalink
feat: add points
Browse files Browse the repository at this point in the history
  • Loading branch information
sogipec committed May 22, 2024
1 parent 33277cd commit dc4c698
Show file tree
Hide file tree
Showing 5 changed files with 887 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,28 @@ import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { ICore } from "../interfaces/ICore.sol";
import "../utils/Errors.sol";

/// @title ProtToken
/// @title PointToken
/// @author Angle Labs, Inc.
/// @notice Base token contract that can only be minted
contract ProtToken is ERC20 {
/// @notice Reference contract for points systems within Merkl
contract PointToken is ERC20 {
mapping(address => bool) public minters;
mapping(address => bool) public whitelistedRecipients;
ICore public core;
ICore public accessControlManager;
uint8 public allowedTransfers;

constructor(string memory name_, string memory symbol_, address _minter, address _core) ERC20(name_, symbol_) {
if (_core == address(0) || _minter == address(0)) revert ZeroAddress();
core = ICore(_core);
constructor(
string memory name_,
string memory symbol_,
address _minter,
address _accessControlManager
) ERC20(name_, symbol_) {
if (_accessControlManager == address(0) || _minter == address(0)) revert ZeroAddress();
accessControlManager = ICore(_accessControlManager);
minters[_minter] = true;
}

modifier onlyGovernorOrGuardian() {
if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();
if (!accessControlManager.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();
_;
}

Expand All @@ -31,10 +36,6 @@ contract ProtToken is ERC20 {
_;
}

function decimals() public pure override returns (uint8) {
return 18;
}

function mint(address account, uint256 amount) external onlyMinter {
_mint(account, amount);
}
Expand Down
30 changes: 30 additions & 0 deletions deploy/pointToken.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { DeployFunction } from 'hardhat-deploy/types';
import yargs from 'yargs';

const argv = yargs.env('').boolean('ci').parseSync();

const func: DeployFunction = async ({ deployments, ethers, network }) => {
const { deploy } = deployments;
const { deployer } = await ethers.getNamedSigners();
let core: string;

const implementationName = 'PointToken';

console.log(`Now deploying ${implementationName}`);
console.log('Starting with the implementation');

await deploy(implementationName, {
contract: implementationName,
from: deployer.address,
args: ["Angle Prots","agProts", "0xA9DdD91249DFdd450E81E1c56Ab60E1A62651701","0xFD0DFC837Fe7ED19B23df589b6F6Da5a775F99E0"],
log: !argv.ci,
});

const implementationAddress = (await ethers.getContract(implementationName)).address;

console.log(`Successfully deployed the contract ${implementationName} at ${implementationAddress}`);
console.log('');
};

func.tags = ['pointToken'];
export default func;
Loading

0 comments on commit dc4c698

Please sign in to comment.