Skip to content
Merged
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
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frax-template",
"version": "1.3.3",
"name": "frax-tokens",
"version": "1.0.0",
"description": "",
"directories": {
"lib": "lib",
Expand All @@ -19,7 +19,6 @@
"author": "Frax Finance",
"license": "ISC",
"devDependencies": {
"@openzeppelin/contracts": "^5.4.0",
"husky": "^8.0.3",
"lint-staged": "^13.3.0",
"prettier": "^3.6.2",
Expand All @@ -34,6 +33,8 @@
"ds-test": "github:dapphub/ds-test",
"forge-std": "github:foundry-rs/forge-std#60acb7aaadcce2d68e52986a0a66fe79f07d138f",
"frax-standard-solidity": "github:FraxFinance/frax-standard-solidity",
"solidity-bytes-utils": "github:GNSPS/solidity-bytes-utils"
"solidity-bytes-utils": "github:GNSPS/solidity-bytes-utils",
"@openzeppelin/contracts-5.2.0": "npm:@openzeppelin/contracts@5.2.0",
"@openzeppelin/contracts-upgradeable-5.2.0": "npm:@openzeppelin/contracts-upgradeable@5.2.0"
}
}
25 changes: 22 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion remappings.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
frax-std/=node_modules/frax-standard-solidity/src/
@prb/test/=node_modules/@prb/test/
forge-std/=node_modules/forge-std/src/
ds-test/=node_modules/ds-test/src/
ds-test/=node_modules/ds-test/src/
@openzeppelin/=node_modules/@openzeppelin/
20 changes: 0 additions & 20 deletions src/contracts/Counter.sol

This file was deleted.

25 changes: 25 additions & 0 deletions src/contracts/fraxtal/fpi/FPI.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
pragma solidity ^0.8.0;

import { ERC20PermitPermissionedOptiMintable } from "src/contracts/fraxtal/shared/ERC20PermitPermissionedOptiMintable.sol";

contract FPI is ERC20PermitPermissionedOptiMintable {
/// @param _creator_address The contract creator
/// @param _timelock_address The timelock
/// @param _bridge Address of the L2 standard bridge
/// @param _remoteToken Address of the corresponding L1 token
constructor(
address _creator_address,
address _timelock_address,
address _bridge,
address _remoteToken
)
ERC20PermitPermissionedOptiMintable(
_creator_address,
_timelock_address,
_bridge,
_remoteToken,
"Frax Price Index",
"FPI"
)
{}
}
7 changes: 7 additions & 0 deletions src/contracts/fraxtal/fpi/IFPI.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pragma solidity ^0.8.0;

import { IERC20PermitPermissionedOptiMintable } from "src/contracts/fraxtal/shared/interfaces/IERC20PermitPermissionedOptiMintable.sol";

/// @title IFPI
/// @notice Interface for the FPI contract
interface IFPI is IERC20PermitPermissionedOptiMintable {}
25 changes: 25 additions & 0 deletions src/contracts/fraxtal/frxBTC/FrxBTC.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
pragma solidity ^0.8.0;

import { ERC20PermitPermissionedOptiMintable } from "src/contracts/fraxtal/shared/ERC20PermitPermissionedOptiMintable.sol";

contract FrxBTC is ERC20PermitPermissionedOptiMintable {
/// @param _creator_address The contract creator
/// @param _timelock_address The timelock
/// @param _bridge Address of the L2 standard bridge
/// @param _remoteToken Address of the corresponding L1 token
constructor(
address _creator_address,
address _timelock_address,
address _bridge,
address _remoteToken
)
ERC20PermitPermissionedOptiMintable(
_creator_address,
_timelock_address,
_bridge,
_remoteToken,
"Frax Bitcoin",
"frxBTC"
)
{}
}
7 changes: 7 additions & 0 deletions src/contracts/fraxtal/frxBTC/IFrxBTC.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pragma solidity ^0.8.0;

import { IERC20PermitPermissionedOptiMintable } from "src/contracts/fraxtal/shared/interfaces/IERC20PermitPermissionedOptiMintable.sol";

/// @title IFrxBTC
/// @notice Interface for the frxUSD contract
interface IFrxBTC is IERC20PermitPermissionedOptiMintable {}
5 changes: 5 additions & 0 deletions src/contracts/fraxtal/frxETH/FrxETH.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma solidity ^0.8.0;

import { ERC20ExWrappedPPOM } from "src/contracts/fraxtal/shared/ERC20ExWrappedPPOM.sol";

contract FrxETH is ERC20ExWrappedPPOM {}
7 changes: 7 additions & 0 deletions src/contracts/fraxtal/frxETH/IFrxETH.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pragma solidity ^0.8.0;

import { IERC20PermitPermissionedOptiMintable } from "src/contracts/fraxtal/shared/interfaces/IERC20PermitPermissionedOptiMintable.sol";

interface IFrxETH is IERC20PermitPermissionedOptiMintable {
function adjustTotalSupply(int256 _newTotalSupplyDiff) external;
}
147 changes: 147 additions & 0 deletions src/contracts/fraxtal/frxUSD/FrxUSD.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
pragma solidity ^0.8.0;

import { ERC20PermitPermissionedOptiMintable } from "src/contracts/fraxtal/shared/ERC20PermitPermissionedOptiMintable.sol";

contract FrxUSD is ERC20PermitPermissionedOptiMintable {
/// @notice Mapping indicating which addresses are frozen
mapping(address => bool) public isFrozen;

/// @notice Whether or not the contract is paused
bool public isPaused;

/// @param _creator_address The contract creator
/// @param _timelock_address The timelock
/// @param _bridge Address of the L2 standard bridge
/// @param _remoteToken Address of the corresponding L1 token
constructor(
address _creator_address,
address _timelock_address,
address _bridge,
address _remoteToken
)
ERC20PermitPermissionedOptiMintable(
_creator_address,
_timelock_address,
_bridge,
_remoteToken,
"Frax USD",
"frxUSD"
)
{}

/// @notice External admin gated function to unfreeze a set of accounts
/// @param _owners Array of accounts to be unfrozen
function thawMany(address[] memory _owners) external onlyOwner {
uint256 len = _owners.length;
for (uint256 i; i < len; ++i) {
_thaw(_owners[i]);
}
}

/// @notice External admin gated function to unfreeze an account
/// @param _owner The account to be unfrozen
function thaw(address _owner) external onlyOwner {
_thaw(_owner);
}

/// @notice External admin gated function to batch freeze a set of accounts
/// @param _owners Array of accounts to be frozen
function freezeMany(address[] memory _owners) external onlyOwner {
uint256 len = _owners.length;
for (uint256 i; i < len; ++i) {
_freeze(_owners[i]);
}
}

/// @notice External admin gated function to freeze a given account
/// @param _owner The account to be
function freeze(address _owner) external onlyOwner {
_freeze(_owner);
}

/// @notice External admin gated function to batch burn balance from a set of accounts
/// @param _owners Array of accounts whose balances will be burned
/// @param _amounts Array of amounts corresponding to the balances to be burned
/// @dev if `_amount` == 0, entire balance will be burned
function burnMany(address[] memory _owners, uint256[] memory _amounts) external onlyOwner {
uint256 lenOwner = _owners.length;
if (_owners.length != _amounts.length) revert ArrayMisMatch();
for (uint256 i; i < lenOwner; ++i) {
if (_amounts[i] == 0) _amounts[i] = balanceOf(_owners[i]);
_burn(_owners[i], _amounts[i]);
}
}

/// @notice External admin gated function to burn balance from a given account
/// @param _owner The account whose balance will be burned
/// @param _amount The amount of balance to burn
/// @dev if `_amount` == 0, entire balance will be burned
function burnFrxUsd(address _owner, uint256 _amount) external onlyOwner {
if (_amount == 0) _amount = balanceOf(_owner);
_burn(_owner, _amount);
}

/// @notice External admin gated pause function
function pause() external onlyOwner {
isPaused = true;
emit Paused();
}

/// @notice External admin gated unpause function
function unpause() external onlyOwner {
isPaused = false;
emit Unpaused();
}

/* ========== Internals For Admin Gated ========== */

/// @notice Internal helper function to freeze an account
/// @param _owner The account to 'frozen'
function _freeze(address _owner) internal {
isFrozen[_owner] = true;
emit AccountFrozen(_owner);
}

/// @notice Internal helper function to unfreeze an account
/// @param _owner The account to unfreeze
function _thaw(address _owner) internal {
isFrozen[_owner] = false;
emit AccountThawed(_owner);
}

/* ========== Overrides ========== */

/// @notice override for base internal `_update(address,address,uint256)`
/// implements `paused` and `frozen` transfer logic
/// @param from The address from which balance is originating
/// @param to The address whose balance will be incremented
/// @param value The amount to increment/decrement the balances of
/// @dev Owner can bypass pause and freeze checks
function _update(address from, address to, uint256 value) internal override {
if (msg.sender != owner) {
if (isPaused) revert IsPaused();
if (isFrozen[to] || isFrozen[from] || isFrozen[msg.sender]) revert IsFrozen();
}
super._update(from, to, value);
}

/* ========== EVENTS ========== */
/// @notice Event Emitted when the contract is paused
event Paused();

/// @notice Event Emitted when the contract is unpaused
event Unpaused();

/// @notice Event Emitted when an address is frozen
/// @param account The account being frozen
event AccountFrozen(address account);

/// @notice Event Emitted when an address is unfrozen
/// @param account The account being thawed
event AccountThawed(address account);

/* ========== ERRORS ========== */
error ArrayMisMatch();
error IsPaused();
error IsFrozen();
}
32 changes: 32 additions & 0 deletions src/contracts/fraxtal/frxUSD/IFrxUSD.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
pragma solidity ^0.8.0;

import { IERC20PermitPermissionedOptiMintable } from "src/contracts/fraxtal/shared/interfaces/IERC20PermitPermissionedOptiMintable.sol";

/// @title IFrxUSD
/// @notice Interface for the frxUSD contract
interface IFrxUSD is IERC20PermitPermissionedOptiMintable {
/// @dev state variables
function isFrozen(address account) external view returns (bool);
function isPaused() external view returns (bool);

/// @dev admin functions
function thawMany(address[] memory _owners) external;
function thaw(address _owner) external;
function freezeMany(address[] memory _owners) external;
function freeze(address _owner) external;
function burnMany(address[] memory _owners, uint256[] memory _amounts) external;
function burnFrxUsd(address _owner, uint256 _amount) external;
function pause() external;
function unpause() external;

/// @dev events
event Paused();
event Unpaused();
event AccountFrozen(address account);
event AccountThawed(address account);

/// @dev errors
error ArrayMisMatch();
error IsPaused();
error IsFrozen();
}
7 changes: 7 additions & 0 deletions src/contracts/fraxtal/sfrxETH/ISfrxETH.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pragma solidity ^0.8.0;

import { IERC20PermitPermissionedOptiMintable } from "src/contracts/fraxtal/shared/interfaces/IERC20PermitPermissionedOptiMintable.sol";

/// @title ISfrxETH
/// @notice Interface for the frxETH contract
interface ISfrxETH is IERC20PermitPermissionedOptiMintable {}
Loading