Keydonix / liquid-long

The Unlicense
8 stars 1 forks source link

Add static call to getCdps #104

Closed epheph closed 5 years ago

epheph commented 5 years ago

Adds back the getCdps code mostly unmodified. Initial call calls into a function which first resolves the DSProxy from the user before calling the underlying function.

One issue is that, from an ABI standpoint, the getCdps is technically not a "view" function, because "maker.tab()" does some housekeeping. We should either accept that oddity, or emulate the logic behind maker.tab() to allow getCdps to be a real view.

 Error: Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
                        uint256 _debtInAttodai = maker.tab(bytes32(_i));
MicahZoltu commented 5 years ago

We have discussed the issue of Maker having .tab be non-view. IIRC, we actually cannot emulate their behavior, which makes me very sad.

epheph commented 5 years ago

This kinda feels like there should be a solidity syntax to override the function call: "i know you think this is a CALL, but make this call as a STATICCALL"

epheph commented 5 years ago

Cannot, because they act on private variables? That does seem familiar

MicahZoltu commented 5 years ago

Yeah, there is no view-only way to read chi if I remember correctly.

epheph commented 5 years ago

Ahh, good ol' chi .