GIX Smart Contract
The GIX smart contract is an ERC-20 token implementation with additional functionality to mint, burn, and adjust the token’s value through a rebase mechanism. It is central to the GasStation protocol and interacts with other contracts like the Executor and Pool contracts. The token uses Gwei-like units and features an adjustable rebase factor to control the total supply and balance of tokens dynamically.
Key Features
ERC-20 Token: Implements the standard ERC-20 token functionality, including minting, burning, and balance checks.
Rebase Mechanism: Adjusts the total supply and user balances based on the rebase factor, enabling dynamic changes to the token’s value.
Owner-Controlled: Only the contract owner can mint, burn, and change the rebase factor.
Functions
mint(address user, uint256 gixShares)
Mints new GIX tokens and assigns them to the specified user
. Only the contract owner can call this function.
Requirements:
Only callable by the owner.
Parameters:
user
: The address receiving the minted GIX tokens.gixShares
: The number of GIX shares to mint.
burn(address user, uint256 gixShares)
Burns the specified number of GIX tokens from the specified user
. Only the contract owner can call this function.
Requirements:
Only callable by the owner.
Parameters:
user
: The address whose GIX tokens will be burned.gixShares
: The number of GIX shares to burn.
totalShareSupply()
Returns the total number of GIX shares in circulation.
Returns: The total GIX share supply.
shareBalanceOf(address account)
Returns the balance of GIX shares for a specific account
.
Returns: The share balance of the
account
.
totalSupply()
Overrides the ERC-20 totalSupply()
function to return the total GIX supply, adjusted by the current rebase factor.
Returns: The total GIX supply, adjusted by the rebase factor.
balanceOf(address account)
Overrides the ERC-20 balanceOf()
function to return the balance of GIX tokens for a specific account
, adjusted by the current rebase factor.
Returns: The adjusted GIX balance of the
account
.
changeRebaseFactor(uint256 newValue)
Allows the contract owner to change the rebase factor, affecting the total supply and balances of all GIX token holders. It emits a RebaseFactorChanged
event upon success.
Requirements:
Only callable by the owner.
Parameters:
newValue
: The new rebase factor to apply.
Events:
RebaseFactorChanged
.
decimals()
Overrides the ERC-20 decimals()
function to return 9 decimals, simulating Gwei-like units.
Returns: 9, representing Gwei-like decimal places.
Events
RebaseFactorChanged: Emitted when the rebase factor is changed, logging the old and new values.
Last updated