GemJoin
Inherits: Ownable2Step, Pausable
Collateral deposits are held independently from the IonPool
core contract, but credited to users through gem
balances.
Separating collateral deposits from the core contract allows for handling tokens with non-standard behavior, if needed. This contract implements access control through Ownable2Step
. This contract implements pausing through OpenZeppelin's Pausable
.
State Variables
GEM
IERC20 public immutable GEM;
POOL
IonPool public immutable POOL;
ILK_INDEX
uint8 public immutable ILK_INDEX;
totalGem
uint256 public totalGem;
Functions
constructor
Creates a new GemJoin
instance.
constructor(IonPool _pool, IERC20 _gem, uint8 _ilkIndex, address owner) Ownable(owner);
Parameters
_pool
IonPool
Address of the IonPool
contract.
_gem
IERC20
ERC20 collateral to be associated with this GemJoin
instance.
_ilkIndex
uint8
of the associated collateral.
owner
address
Admin of the contract.
pause
Pauses the contract.
Pauses the contract.
function pause() external onlyOwner;
unpause
Unpauses the contract.
Unpauses the contract.
function unpause() external onlyOwner;
join
Converts ERC20 token into gem (credit inside of the IonPool
's internal accounting).
Gem will be sourced from msg.sender
and credited to user
.
function join(address user, uint256 amount) external whenNotPaused;
Parameters
user
address
to credit the gem to.
amount
uint256
of gem to add. [WAD]
exit
Debits gem from the IonPool
's internal accounting and withdraws it into ERC20 token.
Gem will be debited from msg.sender
and sent to user
.
function exit(address user, uint256 amount) external whenNotPaused;
Parameters
user
address
to send the withdrawn ERC20 tokens to.
amount
uint256
of gem to remove. [WAD]
Errors
Int256Overflow
error Int256Overflow();
WrongIlkAddress
error WrongIlkAddress(uint8 ilkIndex, IERC20 gem);