Zap from Sonic

Deposit any token into any strategies in a single transaction on Sonic

Normally, if a user deposits a token that is different from the strategy's underlying token, they must first swap it and then deposit. With DogBone, we consolidate these steps into a single transaction. First, we prepare the swap data, execute the swap, and then deposit directly into the strategy. The swap data is obtained from some of the best DEX aggregators on the Sonic blockchain, such as KyberSwap and ODOS.

function zap(Swap memory swapData, Strategy memory T) 
    external 
    payable 
    returns (bytes memory) 
{
    _swap(swapData);
    bytes memory result = doStrategy(T);
    _validate(swapData, T, data);
    return result;
}

// low-level function to swap user input token to strategy's underlying token.
function _swap(Swap memory swapData) internal; 

// function to assure that user receive minimum liquidity required.
function _validate(Swap memory swapData, Strategy memory T, bytes memory result) internal;

/// API for all strategy zaps
/// @param T strategy Data
function doStrategy(Strategy memory T) public payable returns (bytes memory);

Last updated