Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Get borrower_info of previous block heights #54

Open
fentas opened this issue Jan 6, 2022 · 1 comment
Open

[Question] Get borrower_info of previous block heights #54

fentas opened this issue Jan 6, 2022 · 1 comment

Comments

@fentas
Copy link

fentas commented Jan 6, 2022

Hello, not sure if this is the right place for this question.
I am trying to get borrowed amount of previous block heights to calculate the occurred loan fees over time.

WIthout previous knowledge, I just was trying within dev tools to change the request as follows but it always returns the current block height. Ideas?

height=5971055;
address="terra...";
(await (await fetch("https://mantle.terra.dev/?borrow--borrower", {
  "headers": {
    "accept": "application/json",
    "content-type": "application/json"
  },
  "referrer": "https://app.anchorprotocol.com/",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": "{\"query\":\"{\\n  marketBorrowerInfo: WasmContractsContractAddressStore(\\n    ContractAddress: \\\"terra1sepfj7s0aeg5967uxnfk4thzlerrsktkpelm5s\\\"\\n    QueryMsg: \\\"{\\\\\\\"borrower_info\\\\\\\":{\\\\\\\"borrower\\\\\\\":\\\\\\\""+address+"\\\\\\\",\\\\\\\"block_height\\\\\\\":"+height+"}}\\\"\\n  ) {\\n    Result\\n    Height\\n  }\\n}\\n\",\"variables\":{}}",
  "method": "POST",
  "mode": "cors",
  "credentials": "omit"
})).json()).data.marketBorrowerInfo
@fentas
Copy link
Author

fentas commented Jan 12, 2022

So, it seems that block_height is arbitrary.
and other implementations just specify any block_height.
e.g. unl1k3ly/AnchorHODL#15

So is that a bug? Is there any way to find the loan_amount at any given time?

@fentas fentas changed the title [Question] Get marketBorrowerInfo of previous block heights [Question] Get borrower_info of previous block heights Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant