The Redemptions app is initialized by passing a Vault _vault
, TokenManager _tokenManager
and address[] _redeemableTokens
parameters.
_vault
is an Aragon Vault contract_tokenManager
is an Aragon Token Manager contract_redeemableTokens
is the array of eligible assets to be redeem.The Redemptions app must be granted the TRANSFER_ROLE
permission on _vault
and the BURN_ROLE
permission on the _tokenManager
.
Adding tokens to the Redemptions app is done by passing an address _token
to the addRedeemableToken()
function. This must be the address of a token contract.
function addRedeemableToken(address _token) external auth(ADD_TOKEN_ROLE) {
require(_token != address(tokenManager), ERROR_CANNOT_ADD_TOKEN_MANAGER);
require(!redeemableTokenAdded[_token], ERROR_TOKEN_ALREADY_ADDED);
if (_token != ETH) {
require(isContract(_token), ERROR_TOKEN_NOT_CONTRACT);
}
Adding the address to the Redemptions app does not transfer any tokens. What this does do is add a token contract address to the Redemptions app and make it eligible for redemption. If that token is in the Vault
a user will then be able to redeem their tokens for a percentage of those tokens in the Vault
. Concretely this looks like:
redeemableTokens
arraytrue
)redeemableTokenAdded[_token] = true;
redeemableTokens.push(_token);
emit AddRedeemableToken(_token);
}
Removing tokens from the Redemptions app is done by passing an address _token
to the removeRedeemableToken() function. This must be an address that is already added to the Redemptions redeemableTokenAdded
mapping.
function removeRedeemableToken(address _token) external auth(REMOVE_TOKEN_ROLE) {
require(redeemableTokenAdded[_token], ERROR_TOKEN_NOT_ADDED);
Removing an address from the Redemptions app does not transfer any tokens. If a token is in the Vault
and you remove it from the Redemptions app, it will stay in the Vault
. It will, however, no longer be eligible for redemption and will no longer show up in the Redemptions app UI. Concretely this looks like:
_redeemableTokens
arrayfalse
)