GemJoin

Git Source

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

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

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

Errors

Int256Overflow

error Int256Overflow();

WrongIlkAddress

error WrongIlkAddress(uint8 ilkIndex, IERC20 gem);