Interactions

Governance Functions

setBuffer

Sets the buffer rate percentage that determines how much of each reward goes to the buffer.

function setBuffer(uint256 _buffer) external;

Parameters

Name
Type
Description

_buffer

uint256

The buffer percentage (must be less than BUFFER_DENOMINATOR)

Access Control: only Owner (Keeper)

setSymbol

Updates the token symbol.

function setSymbol(string memory _symbol) external;

Parameters

Name
Type
Description

_symbol

string

The new token symbol

Access Control: only Owner (Keeper) withdrawBuffer

Withdraw _amount from Buffer and mint SPAToken shares to _to

function withdrawBuffer(address _to, uint256 _amount) external;

Parameters

Name
Type
Description

_to

address

Recipient address that will receive newly-minted shares

_amount

uint256

Token amount to withdraw

Access: only Owner (via Keeper)

transferShares

Moves _sharesAmount token shares from the caller's account to the _recipient account.

Note: The _sharesAmount argument is the amount of shares, not tokens.

function transferShares(address _recipient, uint256 _sharesAmount)
    external
    returns (uint256);

Parameters

Name
Type
Description

_recipient

address

The address to receive the shares

_sharesAmount

uint256

The amount of shares to transfer (not tokens)

Returns

Name
Type
Description

<none>

uint256

The amount of tokens transferred

transferSharesFrom

Moves _sharesAmount token shares from the _sender account to the _recipient account using the allowance mechanism.

function transferSharesFrom(
    address _sender,
    address _recipient,
    uint256 _sharesAmount
)
    external
    returns (uint256);

Parameters

Name
Type
Description

_sender

address

The address to transfer shares from

_recipient

address

The address to receive the shares

_sharesAmount

uint256

The amount of shares to transfer

Returns

Name
Type
Description

<none>

uint256

The amount of tokens transferred

Requirements: The caller must have sufficient allowance for the sender's tokens.

mintShares

Mints shares for the specified account and transfers them to that account.

function mintShares(address _account, uint256 _tokenAmount)
    external;

Parameters

Name
Type
Description

_account

address

The address to mint shares to

_tokenAmount

uint256

The token amount to mint (converted to shares internally)

Access Control: Only callable by the pool contract.

burnShares

Burns shares from the caller's account.

function burnShares(uint256 _tokenAmount)
    external;

Parameters

Name
Type
Description

_tokenAmount

uint256

The token amount to burn (converted to shares internally)

burnSharesFrom

Burns shares from the specified account using the allowance mechanism.

function burnSharesFrom(address _account, uint256 _tokenAmount)
    external;

Parameters

Name
Type
Description

_account

address

The address to burn shares from

_tokenAmount

uint256

The token amount to burn

Requirements: The caller must have sufficient allowance for the account's tokens.

Supply Management

addTotalSupply

Increases the total supply of SPAToken by staking rewards and swap fees, with automatic buffer allocation.

function addTotalSupply(uint256 _amount)
    external;

Parameters

Name
Type
Description

_amount

uint256

The amount to add to total supply

Access Control: Only callable by the pool contract.

Behavior:

  • payFirst pays down any existing buffer bad debt

  • Allocates a percentage to the buffer based on bufferPercent

  • Remainder increases the actual total supply

removeTotalSupply

Decreases the total supply of SPAToken due to losses, with options for buffer usage and debt tracking.

function removeTotalSupply(uint256 _amount, bool isBuffer, bool withDebt)
    external;

Parameters

Name
Type
Description

_amount

uint256

The amount to remove from total supply

isBuffer

bool

Whether to use buffer funds instead of total supply

withDebt

bool

Whether to add the amount to buffer bad debt

Access Control: Only callable by the pool contract.

addBuffer

Directly increases the buffer amount without affecting total supply.

function addBuffer(uint256 _amount)
    external;

Parameters

Name
Type
Description

_amount

uint256

The amount to add to the buffer

Access Control: Only callable by the pool contract.

View Functions

sharesOf

Returns the amount of shares owned by an account.

function sharesOf(address _account)
    external
    view
    returns (uint256);

Parameters

Name
Type
Description

_account

address

The account to query shares for

Returns

Name
Type
Description

<none>

uint256

The amount of shares owned by the account

getPeggedTokenByShares

Converts a share amount to the corresponding token amount.

function getPeggedTokenByShares(uint256 _sharesAmount)
    public
    view
    returns (uint256);

Parameters

Name
Type
Description

_sharesAmount

uint256

The amount of shares to convert

Returns

Name
Type
Description

<none>

uint256

The corresponding token amount

getSharesByPeggedToken

Converts a token amount to the corresponding share amount.

function getSharesByPeggedToken(uint256 _spaTokenAmount)
    public
    view
    returns (uint256);

Parameters

Name
Type
Description

_spaTokenAmount

uint256

The token amount to convert

Returns

Name
Type
Description

<none>

uint256

The corresponding share amount

Last updated