saffron.finance
HomeGovernanceLaunch App
  • Introduction
  • Saffron Finance
    • ♨️ Saffron V2
      • Saffron KCC
        • Saffron Converter
        • Saffron Insurance Fund
        • Saffron Mojito Adapter v2
        • Saffron Mojito Auto Compounder
        • Saffron Pool v2
        • Saffron Position NFT
        • Saffron Position Token
      • Saffron V2 Protocol
      • Saffron Staking V2
        • Saffron Staking V2
        • SFI Rewarder
    • 🌺Saffron V1
    • 🎓Saffron Academy
    • 📝Whitepaper
  • Governance
    • Vote
    • Governance
  • Community
    • Twitter
    • Telegram
    • Discord
    • Github
    • Medium
    • Youtube
Powered by GitBook
On this page
  • Introduction
  • Miscellaneous State Variables

Was this helpful?

  1. Saffron Finance
  2. ♨️ Saffron V2
  3. Saffron KCC

Saffron Converter

PreviousSaffron KCCNextSaffron Insurance Fund

Last updated 3 years ago

Was this helpful?

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;
}
Type
Name
Description

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

Type
Visibility
Name
Description

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
Type
Name
Description

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)
Type
Name
Description

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)
Type
Name
Description

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)
Type
Name
Description

address

tokenA

address

tokenB

pair_for()

Pair for

function pair_for(address factory, address tokenA, address tokenB) internal pure returns (address pair)
Type
Name
Description

address

factory

address

tokenA

address

tokenB

get_conversion()

Get Conversion

function get_conversion(uint256 i) internal view returns (Conversion memory cv)
Type
Name
Description

uint256

i

propose_governance()

Propose transfer of governance to new address

function propose_governance(address to) external override
Type
Name
Description

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
Type
Name
Description

address

amount_qlp

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

address

to

Address to receive swept assets

Source Code
Source Code
Source Code
Source Code
Source Code
Source Code
Source Code
Source Code
Source Code
Source Code
Source Code
Source Code
Source Code