How to get the exchange rate between ust and aust on smart contract

I am senior blockchain developer.
I am developing the invest platform on terra chain.
I want to deposit the all backed money to anchor protocol to earn.
How to get the exchange rate between Ust and aUst on smart contract.
or using terra.js.
Thanks.
James

To get the exchange rate of UST and aUst on a smart contract you should use a smart query from cosmwasm by sending this query to the market contract

and the response is going to be this

using terra.js you need to send epoch_state query using terra.js like following

lcd.wasm.contractQuery($MARKET_ADDRESS, {epoch_state:{}})

here is an API to call as well:
https://lcd.terra.dev/wasm/contracts/terra1sepfj7s0aeg5967uxnfk4thzlerrsktkpelm5s/store?query_msg={"epoch_state":{}}

1 Like

Thanks a lot.
Regards

one more question.
Can I do to yield from Anchor by depositing?

are you real dev? just check github manually. find the anchor SDK

Thanks
I already developed on smart contract to deposit to Anchor.
And I got the aUST from Anchor.
But someone told me that he received the some UST everyday from Anchor by depositing .
Is it right?
Please let me know.

You can check my work with rust cosmwasm.