#
Zap
This is an util contract to ease the deposit of aura/cvx or any ERC20 into the vault. It will first mint WAR with the amount of aura/cvx you want to deposit, then deposit it into the vault for tWAR.
#
State Variables
#
AURA
Address of the AURA token
address public constant AURA = 0xC0c293ce456fF0ED870ADd98a0828Dd4d2903DBF;
#
CVX
Address of the Convex token
address public constant CVX = 0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B;
#
WETH
Address of the WETH token
address public constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
#
WAR
Address of the War token
address public constant WAR = 0xa8258deE2a677874a48F5320670A869D74f0cbC1;
#
swapRouter
Dex/aggregaor router to call to perform swaps
address public swapRouter;
#
tokenTransferAddress
Address to allow to swap tokens
address public tokenTransferAddress;
#
warMinter
Address of the WarMinter contract
address public warMinter;
#
vault
Address of the ERC4626 vault
address public vault;
#
Functions
#
constructor
constructor(
address initialOwner,
address initialSwapRouter,
address initialTokenTransferAddress,
address initialWarMinter,
address initialVault
) Owned2Step(initialOwner);
#
resetWarlordAllowances
Resets the allowances for Warlord-related interactions.
function resetWarlordAllowances() external onlyOwner;
#
removeWarlordAllowances
Removes the allowances for Warlord-related interactions.
function removeWarlordAllowances() external onlyOwner;
#
removeRouterAllowance
function removeRouterAllowance(address token) external onlyOwner;
#
setWarMinter
Set the WarMinter address
function setWarMinter(address newWarMinter) external onlyOwner;
Parameters
#
setSwapRouter
Set the dex/aggregator router to call to perform swaps
function setSwapRouter(address newSwapRouter) external onlyOwner;
Parameters
#
setTokenTransferAddress
Set the token proxy address to allow to swap tokens
function setTokenTransferAddress(address newTokenTransferAddress) external onlyOwner;
Parameters
#
setVault
Set the vault address
function setVault(address newVault) external onlyOwner;
Parameters
#
_swap
Perform the swap using the router/aggregator
function _swap(address[] memory tokens, bytes[] memory callDatas) internal;
Parameters
#
_performRouterSwap
Perform the swap using the router/aggregator
function _performRouterSwap(bytes memory callData) internal;
Parameters
#
_mintSingleToken
Mint a single vlToken
function _mintSingleToken(address receiver, address vlToken, uint256 amount) internal;
Parameters
#
_swapAndMintSingleToken
Swap to a single vlToken and mint tWAR
function _swapAndMintSingleToken(address receiver, address token, address vlToken, bytes memory callDatas) internal;
Parameters
#
_mintMultipleTokens
Mint multiple vlTokens
function _mintMultipleTokens(address receiver, address[] memory vlTokens, uint256[] memory amounts) internal;
Parameters
#
_swapAndMintMultipleTokens
Swap to multiple vlTokens and mint tWAR
function _swapAndMintMultipleTokens(
address receiver,
address token,
address[] memory vlTokens,
bytes[] memory callDatas
) internal;
Parameters
#
zapEtherToSingleToken
Zaps ether to a single vlToken
function zapEtherToSingleToken(address vlToken, address receiver, bytes calldata callDatas) external payable;
Parameters
#
zapERC20ToSingleToken
Zaps an ERC20 token to a single vlToken
function zapERC20ToSingleToken(
address token,
address vlToken,
uint256 amount,
address receiver,
bytes calldata callDatas
) external;
Parameters
#
zapEtherToMultipleTokens
Zaps ether to multiple vlTokens
function zapEtherToMultipleTokens(address[] calldata vlTokens, address receiver, bytes[] calldata callDatas)
external
payable;
Parameters
#
zapERC20ToMultipleTokens
Zaps an ERC20 token to multiple vlTokens
function zapERC20ToMultipleTokens(
address token,
address[] calldata vlTokens,
uint256 amount,
address receiver,
bytes[] calldata callDatas
) external;
Parameters
#
zapVlToken
Zaps a vlToken to tWAR
function zapVlToken(address vlToken, uint256 amount, address receiver) external;
Parameters
#
zapVlTokens
Zaps multiple vlTokens to tWAR
function zapVlTokens(address[] calldata vlTokens, uint256[] calldata amounts, address receiver) external;
Parameters
#
Events
#
Zapped
This event is emitted when a zap operation occurs.
event Zapped(uint256 mintedAmount, address receiver);
Parameters
#
SetWarMinter
This event is emitted when the WarMinter address is changed.
event SetWarMinter(address newMinter);
Parameters
#
SetWarStaker
This event is emitted when the WarStaker address is changed.
event SetWarStaker(address newStaker);
Parameters
#
SwapRouterUpdated
Event emitted when the swap router is updated
event SwapRouterUpdated(address newSwapRouter);
#
TokenTransferAddressUpdated
Event emitted when the token proxy is updated
event TokenTransferAddressUpdated(address newTokenTransferAddress);
#
VaultUpdated
Event emitted when the vault is updated
event VaultUpdated(address newVault);