Skip to content

Latest commit

 

History

History
2842 lines (2156 loc) · 68.4 KB

ISovryn.md

File metadata and controls

2842 lines (2156 loc) · 68.4 KB

ISovryn.sol

View Source: contracts/interfaces/ISovryn.sol

↗ Extends: State, ProtocolSettingsEvents, LoanSettingsEvents, LoanOpeningsEvents, LoanMaintenanceEvents, LoanClosingsEvents, SwapsEvents, AffiliatesEvents, FeesEvents

ISovryn contract

Structs

LoanReturnData

struct LoanReturnData {
 bytes32 loanId,
 address loanToken,
 address collateralToken,
 uint256 principal,
 uint256 collateral,
 uint256 interestOwedPerDay,
 uint256 interestDepositRemaining,
 uint256 startRate,
 uint256 startMargin,
 uint256 maintenanceMargin,
 uint256 currentMargin,
 uint256 maxLoanTerm,
 uint256 endTimestamp,
 uint256 maxLiquidatable,
 uint256 maxSeizable
}

LoanReturnDataV2

struct LoanReturnDataV2 {
 bytes32 loanId,
 address loanToken,
 address collateralToken,
 address borrower,
 uint256 principal,
 uint256 collateral,
 uint256 interestOwedPerDay,
 uint256 interestDepositRemaining,
 uint256 startRate,
 uint256 startMargin,
 uint256 maintenanceMargin,
 uint256 currentMargin,
 uint256 maxLoanTerm,
 uint256 endTimestamp,
 uint256 maxLiquidatable,
 uint256 maxSeizable,
 uint256 creationTimestamp
}

Events

event PayInterestTransfer(address indexed interestToken, address indexed lender, uint256  effectiveInterest);

Functions


replaceContract

function replaceContract(address target) external nonpayable

Arguments

Name Type Description
target address
Source Code
function replaceContract(address target) external;

setTargets

function setTargets(string[] sigsArr, address[] targetsArr) external nonpayable

Arguments

Name Type Description
sigsArr string[]
targetsArr address[]
Source Code
function setTargets(string[] calldata sigsArr, address[] calldata targetsArr) external;

getTarget

function getTarget(string sig) external view
returns(address)

Arguments

Name Type Description
sig string
Source Code
function getTarget(string calldata sig) external view returns (address);

setSovrynProtocolAddress

function setSovrynProtocolAddress(address newProtocolAddress) external nonpayable

Arguments

Name Type Description
newProtocolAddress address
Source Code
function setSovrynProtocolAddress(address newProtocolAddress) external;

setSOVTokenAddress

function setSOVTokenAddress(address newSovTokenAddress) external nonpayable

Arguments

Name Type Description
newSovTokenAddress address
Source Code
function setSOVTokenAddress(address newSovTokenAddress) external;

setLockedSOVAddress

function setLockedSOVAddress(address newSOVLockedAddress) external nonpayable

Arguments

Name Type Description
newSOVLockedAddress address
Source Code
function setLockedSOVAddress(address newSOVLockedAddress) external;

setMinReferralsToPayoutAffiliates

function setMinReferralsToPayoutAffiliates(uint256 newMinReferrals) external nonpayable

Arguments

Name Type Description
newMinReferrals uint256
Source Code
function setMinReferralsToPayoutAffiliates(uint256 newMinReferrals) external;

setPriceFeedContract

function setPriceFeedContract(address newContract) external nonpayable

Arguments

Name Type Description
newContract address
Source Code
function setPriceFeedContract(address newContract) external;

setSwapsImplContract

function setSwapsImplContract(address newContract) external nonpayable

Arguments

Name Type Description
newContract address
Source Code
function setSwapsImplContract(address newContract) external;

setLoanPool

function setLoanPool(address[] pools, address[] assets) external nonpayable

Arguments

Name Type Description
pools address[]
assets address[]
Source Code
function setLoanPool(address[] calldata pools, address[] calldata assets) external;

setSupportedTokens

function setSupportedTokens(address[] addrs, bool[] toggles) external nonpayable

Arguments

Name Type Description
addrs address[]
toggles bool[]
Source Code
function setSupportedTokens(address[] calldata addrs, bool[] calldata toggles) external;

setLendingFeePercent

function setLendingFeePercent(uint256 newValue) external nonpayable

Arguments

Name Type Description
newValue uint256
Source Code
function setLendingFeePercent(uint256 newValue) external;

setTradingFeePercent

function setTradingFeePercent(uint256 newValue) external nonpayable

Arguments

Name Type Description
newValue uint256
Source Code
function setTradingFeePercent(uint256 newValue) external;

setBorrowingFeePercent

function setBorrowingFeePercent(uint256 newValue) external nonpayable

Arguments

Name Type Description
newValue uint256
Source Code
function setBorrowingFeePercent(uint256 newValue) external;

setSwapExternalFeePercent

function setSwapExternalFeePercent(uint256 newValue) external nonpayable

Arguments

Name Type Description
newValue uint256
Source Code
function setSwapExternalFeePercent(uint256 newValue) external;

setAffiliateFeePercent

function setAffiliateFeePercent(uint256 newValue) external nonpayable

Arguments

Name Type Description
newValue uint256
Source Code
function setAffiliateFeePercent(uint256 newValue) external;

setAffiliateTradingTokenFeePercent

function setAffiliateTradingTokenFeePercent(uint256 newValue) external nonpayable

Arguments

Name Type Description
newValue uint256
Source Code
function setAffiliateTradingTokenFeePercent(uint256 newValue) external;

setLiquidationIncentivePercent

function setLiquidationIncentivePercent(uint256 newAmount) external nonpayable

Arguments

Name Type Description
newAmount uint256
Source Code
function setLiquidationIncentivePercent(uint256 newAmount) external;

setMaxDisagreement

function setMaxDisagreement(uint256 newAmount) external nonpayable

Arguments

Name Type Description
newAmount uint256
Source Code
function setMaxDisagreement(uint256 newAmount) external;

setSourceBuffer

function setSourceBuffer(uint256 newAmount) external nonpayable

Arguments

Name Type Description
newAmount uint256
Source Code
function setSourceBuffer(uint256 newAmount) external;

setMaxSwapSize

function setMaxSwapSize(uint256 newAmount) external nonpayable

Arguments

Name Type Description
newAmount uint256
Source Code
function setMaxSwapSize(uint256 newAmount) external;

setFeesController

function setFeesController(address newController) external nonpayable

Arguments

Name Type Description
newController address
Source Code
function setFeesController(address newController) external;

withdrawLendingFees

function withdrawLendingFees(address token, address receiver, uint256 amount) external nonpayable
returns(bool)

Arguments

Name Type Description
token address
receiver address
amount uint256
Source Code
function withdrawLendingFees(
        address token,
        address receiver,
        uint256 amount
    ) external returns (bool);

withdrawTradingFees

function withdrawTradingFees(address token, address receiver, uint256 amount) external nonpayable
returns(bool)

Arguments

Name Type Description
token address
receiver address
amount uint256
Source Code
function withdrawTradingFees(
        address token,
        address receiver,
        uint256 amount
    ) external returns (bool);

withdrawBorrowingFees

function withdrawBorrowingFees(address token, address receiver, uint256 amount) external nonpayable
returns(bool)

Arguments

Name Type Description
token address
receiver address
amount uint256
Source Code
function withdrawBorrowingFees(
        address token,
        address receiver,
        uint256 amount
    ) external returns (bool);

withdrawProtocolToken

function withdrawProtocolToken(address receiver, uint256 amount) external nonpayable
returns(address, bool)

Arguments

Name Type Description
receiver address
amount uint256
Source Code
function withdrawProtocolToken(address receiver, uint256 amount)
        external
        returns (address, bool);

depositProtocolToken

function depositProtocolToken(uint256 amount) external nonpayable

Arguments

Name Type Description
amount uint256
Source Code
function depositProtocolToken(uint256 amount) external;

getLoanPoolsList

function getLoanPoolsList(uint256 start, uint256 count) external view
returns(bytes32[])

Arguments

Name Type Description
start uint256
count uint256
Source Code
function getLoanPoolsList(uint256 start, uint256 count)
        external
        view
        returns (bytes32[] memory);

isLoanPool

function isLoanPool(address loanPool) external view
returns(bool)

Arguments

Name Type Description
loanPool address
Source Code
function isLoanPool(address loanPool) external view returns (bool);

setWrbtcToken

function setWrbtcToken(address wrbtcTokenAddress) external nonpayable

Arguments

Name Type Description
wrbtcTokenAddress address
Source Code
function setWrbtcToken(address wrbtcTokenAddress) external;

setSovrynSwapContractRegistryAddress

function setSovrynSwapContractRegistryAddress(address registryAddress) external nonpayable

Arguments

Name Type Description
registryAddress address
Source Code
function setSovrynSwapContractRegistryAddress(address registryAddress) external;

setProtocolTokenAddress

function setProtocolTokenAddress(address _protocolTokenAddress) external nonpayable

Arguments

Name Type Description
_protocolTokenAddress address
Source Code
function setProtocolTokenAddress(address _protocolTokenAddress) external;

setRolloverBaseReward

function setRolloverBaseReward(uint256 transactionCost) external nonpayable

Arguments

Name Type Description
transactionCost uint256
Source Code
function setRolloverBaseReward(uint256 transactionCost) external;

setRebatePercent

function setRebatePercent(uint256 rebatePercent) external nonpayable

Arguments

Name Type Description
rebatePercent uint256
Source Code
function setRebatePercent(uint256 rebatePercent) external;

setSpecialRebates

function setSpecialRebates(address sourceToken, address destToken, uint256 specialRebatesPercent) external nonpayable

Arguments

Name Type Description
sourceToken address
destToken address
specialRebatesPercent uint256
Source Code
function setSpecialRebates(
        address sourceToken,
        address destToken,
        uint256 specialRebatesPercent
    ) external;

getSpecialRebates

function getSpecialRebates(address sourceToken, address destToken) external view
returns(specialRebatesPercent uint256)

Arguments

Name Type Description
sourceToken address
destToken address
Source Code
function getSpecialRebates(address sourceToken, address destToken)
        external
        view
        returns (uint256 specialRebatesPercent);

togglePaused

function togglePaused(bool paused) external nonpayable

Arguments

Name Type Description
paused bool
Source Code
function togglePaused(bool paused) external;

isProtocolPaused

function isProtocolPaused() external view
returns(bool)
Source Code
function isProtocolPaused() external view returns (bool);

setupLoanParams

function setupLoanParams(struct LoanParamsStruct.LoanParams[] loanParamsList) external nonpayable
returns(loanParamsIdList bytes32[])

Arguments

Name Type Description
loanParamsList struct LoanParamsStruct.LoanParams[]
Source Code
function setupLoanParams(LoanParams[] calldata loanParamsList)
        external
        returns (bytes32[] memory loanParamsIdList);

disableLoanParams

function disableLoanParams(bytes32[] loanParamsIdList) external nonpayable

Arguments

Name Type Description
loanParamsIdList bytes32[]
Source Code
function disableLoanParams(bytes32[] calldata loanParamsIdList) external;

getLoanParams

function getLoanParams(bytes32[] loanParamsIdList) external view
returns(loanParamsList struct LoanParamsStruct.LoanParams[])

Arguments

Name Type Description
loanParamsIdList bytes32[]
Source Code
function getLoanParams(bytes32[] calldata loanParamsIdList)
        external
        view
        returns (LoanParams[] memory loanParamsList);

getLoanParamsList

function getLoanParamsList(address owner, uint256 start, uint256 count) external view
returns(loanParamsList bytes32[])

Arguments

Name Type Description
owner address
start uint256
count uint256
Source Code
function getLoanParamsList(
        address owner,
        uint256 start,
        uint256 count
    ) external view returns (bytes32[] memory loanParamsList);

getTotalPrincipal

function getTotalPrincipal(address lender, address loanToken) external view
returns(uint256)

Arguments

Name Type Description
lender address
loanToken address
Source Code
function getTotalPrincipal(address lender, address loanToken) external view returns (uint256);

minInitialMargin

function minInitialMargin(bytes32 loanParamsId) external view
returns(uint256)

Arguments

Name Type Description
loanParamsId bytes32
Source Code
function minInitialMargin(bytes32 loanParamsId) external view returns (uint256);

borrowOrTradeFromPool

function borrowOrTradeFromPool(bytes32 loanParamsId, bytes32 loanId, bool isTorqueLoan, uint256 initialMargin, struct MarginTradeStructHelpers.SentAddresses sentAddresses, struct MarginTradeStructHelpers.SentAmounts sentValues, bytes loanDataBytes) external payable
returns(uint256)

Arguments

Name Type Description
loanParamsId bytes32
loanId bytes32
isTorqueLoan bool
initialMargin uint256
sentAddresses struct MarginTradeStructHelpers.SentAddresses
sentValues struct MarginTradeStructHelpers.SentAmounts
loanDataBytes bytes
Source Code
function borrowOrTradeFromPool(
        bytes32 loanParamsId,
        bytes32 loanId, // if 0, start a new loan
        bool isTorqueLoan,
        uint256 initialMargin,
        MarginTradeStructHelpers.SentAddresses calldata sentAddresses,
        // lender: must match loan if loanId provided
        // borrower: must match loan if loanId provided
        // receiver: receiver of funds (address(0) assumes borrower address)
        // manager: delegated manager of loan unless address(0)
        MarginTradeStructHelpers.SentAmounts calldata sentValues,
        // newRate: new loan interest rate
        // newPrincipal: new loan size (borrowAmount + any borrowed interest)
        // torqueInterest: new amount of interest to escrow for Torque loan (determines initial loan length)
        // loanTokenReceived: total loanToken deposit (amount not sent to borrower in the case of Torque loans)
        // collateralTokenReceived: total collateralToken deposit
        bytes calldata loanDataBytes
    ) external payable returns (uint256);

setDelegatedManager

function setDelegatedManager(bytes32 loanId, address delegated, bool toggle) external nonpayable

Arguments

Name Type Description
loanId bytes32
delegated address
toggle bool
Source Code
function setDelegatedManager(
        bytes32 loanId,
        address delegated,
        bool toggle
    ) external;

getEstimatedMarginExposure

function getEstimatedMarginExposure(address loanToken, address collateralToken, uint256 loanTokenSent, uint256 collateralTokenSent, uint256 interestRate, uint256 newPrincipal) external view
returns(uint256)

Arguments

Name Type Description
loanToken address
collateralToken address
loanTokenSent uint256
collateralTokenSent uint256
interestRate uint256
newPrincipal uint256
Source Code
function getEstimatedMarginExposure(
        address loanToken,
        address collateralToken,
        uint256 loanTokenSent,
        uint256 collateralTokenSent,
        uint256 interestRate,
        uint256 newPrincipal
    ) external view returns (uint256);

getRequiredCollateral

function getRequiredCollateral(address loanToken, address collateralToken, uint256 newPrincipal, uint256 marginAmount, bool isTorqueLoan) external view
returns(collateralAmountRequired uint256)

Arguments

Name Type Description
loanToken address
collateralToken address
newPrincipal uint256
marginAmount uint256
isTorqueLoan bool
Source Code
function getRequiredCollateral(
        address loanToken,
        address collateralToken,
        uint256 newPrincipal,
        uint256 marginAmount,
        bool isTorqueLoan
    ) external view returns (uint256 collateralAmountRequired);

getBorrowAmount

function getBorrowAmount(address loanToken, address collateralToken, uint256 collateralTokenAmount, uint256 marginAmount, bool isTorqueLoan) external view
returns(borrowAmount uint256)

Arguments

Name Type Description
loanToken address
collateralToken address
collateralTokenAmount uint256
marginAmount uint256
isTorqueLoan bool
Source Code
function getBorrowAmount(
        address loanToken,
        address collateralToken,
        uint256 collateralTokenAmount,
        uint256 marginAmount,
        bool isTorqueLoan
    ) external view returns (uint256 borrowAmount);

liquidate

function liquidate(bytes32 loanId, address receiver, uint256 closeAmount) external payable
returns(loanCloseAmount uint256, seizedAmount uint256, seizedToken address)

Arguments

Name Type Description
loanId bytes32
receiver address
closeAmount uint256
Source Code
function liquidate(
        bytes32 loanId,
        address receiver,
        uint256 closeAmount // denominated in loanToken
    )
        external
        payable
        returns (
            uint256 loanCloseAmount,
            uint256 seizedAmount,
            address seizedToken
        );

rollover

function rollover(bytes32 loanId, bytes loanDataBytes) external nonpayable

Arguments

Name Type Description
loanId bytes32
loanDataBytes bytes
Source Code
function rollover(bytes32 loanId, bytes calldata loanDataBytes) external;

closeWithDeposit

function closeWithDeposit(bytes32 loanId, address receiver, uint256 depositAmount) external payable
returns(loanCloseAmount uint256, withdrawAmount uint256, withdrawToken address)

Arguments

Name Type Description
loanId bytes32
receiver address
depositAmount uint256
Source Code
function closeWithDeposit(
        bytes32 loanId,
        address receiver,
        uint256 depositAmount // denominated in loanToken
    )
        external
        payable
        returns (
            uint256 loanCloseAmount,
            uint256 withdrawAmount,
            address withdrawToken
        );

closeWithSwap

function closeWithSwap(bytes32 loanId, address receiver, uint256 swapAmount, bool returnTokenIsCollateral, bytes loanDataBytes) external nonpayable
returns(loanCloseAmount uint256, withdrawAmount uint256, withdrawToken address)

Arguments

Name Type Description
loanId bytes32
receiver address
swapAmount uint256
returnTokenIsCollateral bool
loanDataBytes bytes
Source Code
function closeWithSwap(
        bytes32 loanId,
        address receiver,
        uint256 swapAmount, // denominated in collateralToken
        bool returnTokenIsCollateral, // true: withdraws collateralToken, false: withdraws loanToken
        bytes calldata loanDataBytes
    )
        external
        returns (
            uint256 loanCloseAmount,
            uint256 withdrawAmount,
            address withdrawToken
        );

depositCollateral

function depositCollateral(bytes32 loanId, uint256 depositAmount) external payable

Arguments

Name Type Description
loanId bytes32
depositAmount uint256
Source Code
function depositCollateral(
        bytes32 loanId,
        uint256 depositAmount // must match msg.value if ether is sent
    ) external payable;

withdrawCollateral

function withdrawCollateral(bytes32 loanId, address receiver, uint256 withdrawAmount) external nonpayable
returns(actualWithdrawAmount uint256)

Arguments

Name Type Description
loanId bytes32
receiver address
withdrawAmount uint256
Source Code
function withdrawCollateral(
        bytes32 loanId,
        address receiver,
        uint256 withdrawAmount
    ) external returns (uint256 actualWithdrawAmount);

extendLoanByInterest

function extendLoanByInterest(bytes32 loanId, address payer, uint256 depositAmount, bool useCollateral, bytes loanDataBytes) external payable
returns(secondsExtended uint256)

Arguments

Name Type Description
loanId bytes32
payer address
depositAmount uint256
useCollateral bool
loanDataBytes bytes
Source Code
function extendLoanByInterest(
        bytes32 loanId,
        address payer,
        uint256 depositAmount,
        bool useCollateral,
        bytes calldata loanDataBytes
    ) external payable returns (uint256 secondsExtended);

reduceLoanByInterest

function reduceLoanByInterest(bytes32 loanId, address receiver, uint256 withdrawAmount) external nonpayable
returns(secondsReduced uint256)

Arguments

Name Type Description
loanId bytes32
receiver address
withdrawAmount uint256
Source Code
function reduceLoanByInterest(
        bytes32 loanId,
        address receiver,
        uint256 withdrawAmount
    ) external returns (uint256 secondsReduced);

withdrawAccruedInterest

function withdrawAccruedInterest(address loanToken) external nonpayable

Arguments

Name Type Description
loanToken address
Source Code
function withdrawAccruedInterest(address loanToken) external;

getLenderInterestData

function getLenderInterestData(address lender, address loanToken) external view
returns(interestPaid uint256, interestPaidDate uint256, interestOwedPerDay uint256, interestUnPaid uint256, interestFeePercent uint256, principalTotal uint256)

Arguments

Name Type Description
lender address
loanToken address
Source Code
function getLenderInterestData(address lender, address loanToken)
        external
        view
        returns (
            uint256 interestPaid,
            uint256 interestPaidDate,
            uint256 interestOwedPerDay,
            uint256 interestUnPaid,
            uint256 interestFeePercent,
            uint256 principalTotal
        );

getLoanInterestData

function getLoanInterestData(bytes32 loanId) external view
returns(loanToken address, interestOwedPerDay uint256, interestDepositTotal uint256, interestDepositRemaining uint256)

Arguments

Name Type Description
loanId bytes32
Source Code
function getLoanInterestData(bytes32 loanId)
        external
        view
        returns (
            address loanToken,
            uint256 interestOwedPerDay,
            uint256 interestDepositTotal,
            uint256 interestDepositRemaining
        );

getUserLoans

function getUserLoans(address user, uint256 start, uint256 count, uint256 loanType, bool isLender, bool unsafeOnly) external view
returns(loansData struct ISovryn.LoanReturnData[])

Arguments

Name Type Description
user address
start uint256
count uint256
loanType uint256
isLender bool
unsafeOnly bool
Source Code
function getUserLoans(
        address user,
        uint256 start,
        uint256 count,
        uint256 loanType,
        bool isLender,
        bool unsafeOnly
    ) external view returns (LoanReturnData[] memory loansData);

getUserLoansV2

function getUserLoansV2(address user, uint256 start, uint256 count, uint256 loanType, bool isLender, bool unsafeOnly) external view
returns(loansDataV2 struct ISovryn.LoanReturnDataV2[])

Arguments

Name Type Description
user address
start uint256
count uint256
loanType uint256
isLender bool
unsafeOnly bool
Source Code
function getUserLoansV2(
        address user,
        uint256 start,
        uint256 count,
        uint256 loanType,
        bool isLender,
        bool unsafeOnly
    ) external view returns (LoanReturnDataV2[] memory loansDataV2);

getLoan

function getLoan(bytes32 loanId) external view
returns(loanData struct ISovryn.LoanReturnData)

Arguments

Name Type Description
loanId bytes32
Source Code
function getLoan(bytes32 loanId) external view returns (LoanReturnData memory loanData);

getLoanV2

function getLoanV2(bytes32 loanId) external view
returns(loanDataV2 struct ISovryn.LoanReturnDataV2)

Arguments

Name Type Description
loanId bytes32
Source Code
function getLoanV2(bytes32 loanId) external view returns (LoanReturnDataV2 memory loanDataV2);

getActiveLoans

function getActiveLoans(uint256 start, uint256 count, bool unsafeOnly) external view
returns(loansData struct ISovryn.LoanReturnData[])

Arguments

Name Type Description
start uint256
count uint256
unsafeOnly bool
Source Code
function getActiveLoans(
        uint256 start,
        uint256 count,
        bool unsafeOnly
    ) external view returns (LoanReturnData[] memory loansData);

getActiveLoansV2

function getActiveLoansV2(uint256 start, uint256 count, bool unsafeOnly) external view
returns(loansDataV2 struct ISovryn.LoanReturnDataV2[])

Arguments

Name Type Description
start uint256
count uint256
unsafeOnly bool
Source Code
function getActiveLoansV2(
        uint256 start,
        uint256 count,
        bool unsafeOnly
    ) external view returns (LoanReturnDataV2[] memory loansDataV2);

setLegacyOracles

function setLegacyOracles(address[] refs, address[] oracles) external nonpayable

Arguments

Name Type Description
refs address[]
oracles address[]
Source Code
function setLegacyOracles(address[] calldata refs, address[] calldata oracles) external;

getLegacyOracle

function getLegacyOracle(address ref) external view
returns(address)

Arguments

Name Type Description
ref address
Source Code
function getLegacyOracle(address ref) external view returns (address);

swapExternal

function swapExternal(address sourceToken, address destToken, address receiver, address returnToSender, uint256 sourceTokenAmount, uint256 requiredDestTokenAmount, uint256 minReturn, bytes swapData) external nonpayable
returns(destTokenAmountReceived uint256, sourceTokenAmountUsed uint256)

Arguments

Name Type Description
sourceToken address
destToken address
receiver address
returnToSender address
sourceTokenAmount uint256
requiredDestTokenAmount uint256
minReturn uint256
swapData bytes
Source Code
function swapExternal(
        address sourceToken,
        address destToken,
        address receiver,
        address returnToSender,
        uint256 sourceTokenAmount,
        uint256 requiredDestTokenAmount,
        uint256 minReturn,
        bytes calldata swapData
    ) external returns (uint256 destTokenAmountReceived, uint256 sourceTokenAmountUsed);

getSwapExpectedReturn

function getSwapExpectedReturn(address sourceToken, address destToken, uint256 sourceTokenAmount) external view
returns(uint256)

Arguments

Name Type Description
sourceToken address
destToken address
sourceTokenAmount uint256
Source Code
function getSwapExpectedReturn(
        address sourceToken,
        address destToken,
        uint256 sourceTokenAmount
    ) external view returns (uint256);

checkPriceDivergence

function checkPriceDivergence(address sourceToken, address destToken, uint256 sourceTokenAmount, uint256 minReturn) public view

Arguments

Name Type Description
sourceToken address
destToken address
sourceTokenAmount uint256
minReturn uint256
Source Code
function checkPriceDivergence(
        address sourceToken,
        address destToken,
        uint256 sourceTokenAmount,
        uint256 minReturn
    ) public view;

getUserNotFirstTradeFlag

function getUserNotFirstTradeFlag(address user) external view
returns(bool)

Arguments

Name Type Description
user address
Source Code
function getUserNotFirstTradeFlag(address user) external view returns (bool);

setUserNotFirstTradeFlag

function setUserNotFirstTradeFlag(address user) external view
returns(bool)

Arguments

Name Type Description
user address
Source Code
function setUserNotFirstTradeFlag(address user) external view returns (bool);

payTradingFeeToAffiliatesReferrer

function payTradingFeeToAffiliatesReferrer(address referrer, address trader, address token, uint256 tradingFeeTokenBaseAmount) external nonpayable
returns(affiliatesBonusSOVAmount uint256, affiliatesBonusTokenAmount uint256)

Arguments

Name Type Description
referrer address
trader address
token address
tradingFeeTokenBaseAmount uint256
Source Code
function payTradingFeeToAffiliatesReferrer(
        address referrer,
        address trader,
        address token,
        uint256 tradingFeeTokenBaseAmount
    ) external returns (uint256 affiliatesBonusSOVAmount, uint256 affiliatesBonusTokenAmount);

setAffiliatesReferrer

function setAffiliatesReferrer(address user, address referrer) external nonpayable

Arguments

Name Type Description
user address
referrer address
Source Code
function setAffiliatesReferrer(address user, address referrer) external;

getReferralsList

function getReferralsList(address referrer) external view
returns(refList address[])

Arguments

Name Type Description
referrer address
Source Code
function getReferralsList(address referrer) external view returns (address[] memory refList);

getAffiliatesReferrerBalances

function getAffiliatesReferrerBalances(address referrer) external view
returns(referrerTokensList address[], referrerTokensBalances uint256[])

Arguments

Name Type Description
referrer address
Source Code
function getAffiliatesReferrerBalances(address referrer)
        external
        view
        returns (address[] memory referrerTokensList, uint256[] memory referrerTokensBalances);

getAffiliatesReferrerTokensList

function getAffiliatesReferrerTokensList(address referrer) external view
returns(tokensList address[])

Arguments

Name Type Description
referrer address
Source Code
function getAffiliatesReferrerTokensList(address referrer)
        external
        view
        returns (address[] memory tokensList);

getAffiliatesReferrerTokenBalance

function getAffiliatesReferrerTokenBalance(address referrer, address token) external view
returns(uint256)

Arguments

Name Type Description
referrer address
token address
Source Code
function getAffiliatesReferrerTokenBalance(address referrer, address token)
        external
        view
        returns (uint256);

withdrawAffiliatesReferrerTokenFees

function withdrawAffiliatesReferrerTokenFees(address token, address receiver, uint256 amount) external nonpayable
returns(withdrawAmount uint256)

Arguments

Name Type Description
token address
receiver address
amount uint256
Source Code
function withdrawAffiliatesReferrerTokenFees(
        address token,
        address receiver,
        uint256 amount
    ) external returns (uint256 withdrawAmount);

withdrawAllAffiliatesReferrerTokenFees

function withdrawAllAffiliatesReferrerTokenFees(address receiver) external nonpayable

Arguments

Name Type Description
receiver address
Source Code
function withdrawAllAffiliatesReferrerTokenFees(address receiver) external;

getProtocolAddress

function getProtocolAddress() external view
returns(address)
Source Code
function getProtocolAddress() external view returns (address);

getSovTokenAddress

function getSovTokenAddress() external view
returns(address)
Source Code
function getSovTokenAddress() external view returns (address);

getLockedSOVAddress

function getLockedSOVAddress() external view
returns(address)
Source Code
function getLockedSOVAddress() external view returns (address);

getFeeRebatePercent

function getFeeRebatePercent() external view
returns(uint256)
Source Code
function getFeeRebatePercent() external view returns (uint256);

getMinReferralsToPayout

function getMinReferralsToPayout() external view
returns(uint256)
Source Code
function getMinReferralsToPayout() external view returns (uint256);

getAffiliatesUserReferrer

function getAffiliatesUserReferrer(address user) external view
returns(referrer address)

Arguments

Name Type Description
user address
Source Code
function getAffiliatesUserReferrer(address user) external view returns (address referrer);

getAffiliateRewardsHeld

function getAffiliateRewardsHeld(address referrer) external view
returns(uint256)

Arguments

Name Type Description
referrer address
Source Code
function getAffiliateRewardsHeld(address referrer) external view returns (uint256);

getAffiliateTradingTokenFeePercent

function getAffiliateTradingTokenFeePercent() external view
returns(affiliateTradingTokenFeePercent uint256)
Source Code
function getAffiliateTradingTokenFeePercent()
        external
        view
        returns (uint256 affiliateTradingTokenFeePercent);

getAffiliatesTokenRewardsValueInRbtc

function getAffiliatesTokenRewardsValueInRbtc(address referrer) external view
returns(rbtcTotalAmount uint256)

Arguments

Name Type Description
referrer address
Source Code
function getAffiliatesTokenRewardsValueInRbtc(address referrer)
        external
        view
        returns (uint256 rbtcTotalAmount);

getSwapExternalFeePercent

function getSwapExternalFeePercent() external view
returns(swapExternalFeePercent uint256)
Source Code
function getSwapExternalFeePercent() external view returns (uint256 swapExternalFeePercent);

setTradingRebateRewardsBasisPoint

function setTradingRebateRewardsBasisPoint(uint256 newBasisPoint) external nonpayable

Arguments

Name Type Description
newBasisPoint uint256
Source Code
function setTradingRebateRewardsBasisPoint(uint256 newBasisPoint) external;

getTradingRebateRewardsBasisPoint

function getTradingRebateRewardsBasisPoint() external view
returns(uint256)
Source Code
function getTradingRebateRewardsBasisPoint() external view returns (uint256);

getDedicatedSOVRebate

function getDedicatedSOVRebate() external view
returns(uint256)
Source Code
function getDedicatedSOVRebate() external view returns (uint256);

setRolloverFlexFeePercent

function setRolloverFlexFeePercent(uint256 newRolloverFlexFeePercent) external nonpayable

Arguments

Name Type Description
newRolloverFlexFeePercent uint256
Source Code
function setRolloverFlexFeePercent(uint256 newRolloverFlexFeePercent) external;

getDefaultPathConversion

function getDefaultPathConversion(address sourceTokenAddress, address destTokenAddress) external view
returns(contract IERC20[])

Arguments

Name Type Description
sourceTokenAddress address
destTokenAddress address
Source Code
function getDefaultPathConversion(address sourceTokenAddress, address destTokenAddress)
        external
        view
        returns (IERC20[] memory);

setDefaultPathConversion

function setDefaultPathConversion(IERC20[] defaultPath) external nonpayable

Arguments

Name Type Description
defaultPath IERC20[]
Source Code
function setDefaultPathConversion(IERC20[] calldata defaultPath) external;

removeDefaultPathConversion

function removeDefaultPathConversion(address sourceTokenAddress, address destTokenAddress) external nonpayable

Arguments

Name Type Description
sourceTokenAddress address
destTokenAddress address
Source Code
function removeDefaultPathConversion(address sourceTokenAddress, address destTokenAddress)
        external;

checkCloseWithDepositIsTinyPosition

function checkCloseWithDepositIsTinyPosition(bytes32 loanId, uint256 depositAmount) external view
returns(isTinyPosition bool, tinyPositionAmount uint256)

Arguments

Name Type Description
loanId bytes32
depositAmount uint256
Source Code
function checkCloseWithDepositIsTinyPosition(bytes32 loanId, uint256 depositAmount)
        external
        view
        returns (bool isTinyPosition, uint256 tinyPositionAmount);

Contracts