the title explain itself, im using the OneSplit contract to get the price of a pair in 1inch. But the whole point is that i used getExpectedReturn correctly but it returns a value with no decimals and its not really that useful for me. Is there any way i can get more precision? Code i've made:

# Gets the 1inch DAO price for ETH
token2_checksum = w3.toChecksumAddress("0x6B175474E89094C44DA98B954EEDEAC495271D0F")
oneinchETHPRICE = exchange_contract.functions.getExpectedReturn(

def oneinch_ETH_DAI():

And it returns for example 3990, but what i want is 3990.3289482948329 (example).

Thanks for reading, <3


Not sure which version you are working with but my call only take 3 arguments.

const oneSplitData = await fetchOneSplitData({
      fromToken: assetOrder[1],                   // from the quoted asset
      toToken: assetOrder[2],                     // back to Loan asset/base asset
      amount: zrxOrder.makerAssetAmount,          // The amount     

The amount should be provided in WEI

1 ETH (18 decimals) = "1000000000000000000" <-- it's a string

1 DAI is the same.

I'm not sure what the 2 other 1, 1 are for since my call don't require them

By adding all the 0 you should get an accurate reading.

I use ethers.io to parse my numbers. Take a look at the parseEher / formatUnit method.


Not 100% sure that 1Inch use


for eth. I know Matic does.

  • Thanks cuh, but is this python? Also where is fetchOneSplitData function on the OneSplitAudit contract? Kinda confused.
    – mskraod
    Oct 27 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.