Saffron Converter

Introduction

Saffron Converter

struct Conversion

Structure containing conversion steps for swapping tokens with any Uniswap V2 style router

struct Conversion {
  address router;
  address token_from;
  address token_to;
  uint256 percentage;
  uint256 operation;
}
TypeNameDescription

address

router

Router to do the conversion: QuickSwap, SushiSwap, etc.

address

token_from

Token to convert from

address

token_to

Token to convert to

uint256

percentage

Percentage of tokenFrom to convert: 50 == half, 100 == all

uint256

operation

Bitmask of operations: 1=remove, 2=swap, 4=add, 8=fee-on-transfer

Miscellaneous State Variables

TypeVisibilityNameDescription

address

public

governance

Governance address

address

public

new_governance

Pending governance address if accepted

Conversion[]

public

conversions

List of supported conversions

uint256

private

_convert_status

Internal state for reentrancy guard

preapprove_conversions()

Pre approve conversions

function preapprove_conversions() public

init_conversions()

Init conversions

function init_conversions(address[] memory routers, address[] memory tokens_from, address[] memory tokens_to, uint256[] memory percentages, uint256[] memory operations) external
TypeNameDescription

address[]

routers

address[]

tokens_from

address[]

tokens_to

uint256[]

percentages

uint256[]

operations

convert()

Convert

function convert() internal non_reentrant_convert

remove_liquidity_would_return_zero()

function remove_liquidity_would_return_zero(uint256 balance_to_burn, address _pair_address) internal view returns (bool)
TypeNameDescription

uint256

balance_to_burn

address

_pair_address

get_amount_out()

Get amount out

function get_amount_out(uint amountIn, uint reserveIn, uint reserveOut, uint swapFeeNumerator) internal pure returns (uint amountOut)
TypeNameDescription

uint

amountIn

uint

reserveIn

uint

reserveOut

uint

swapFeeNumerator

sort_tokens()

Sort tokens

function sort_tokens(address tokenA, address tokenB) internal pure returns (address token0, address token1)
TypeNameDescription

address

tokenA

address

tokenB

pair_for()

Pair for

function pair_for(address factory, address tokenA, address tokenB) internal pure returns (address pair)
TypeNameDescription

address

factory

address

tokenA

address

tokenB

get_conversion()

Get Conversion

function get_conversion(uint256 i) internal view returns (Conversion memory cv)
TypeNameDescription

uint256

i

propose_governance()

Propose transfer of governance to new address

function propose_governance(address to) external override
TypeNameDescription

address

to

Address of proposed new governance

accept_governance()

Accept the role of governance (must be called by previously proposed candidate)

function accept_governance() external override

sweep_erc()

Transfer LP assets to Mojito Staking

function sweep_erc(address _token, address _to) external
TypeNameDescription

address

amount_qlp

Amount (wei) of LP Assets to be staked in Mojito

address

to

Address to receive swept assets

Last updated