Created
December 2, 2021 16:56
-
-
Save fxfactorial/af1cb7b4fd18d9359b16be5d235e6c6b to your computer and use it in GitHub Desktop.
StableSwapAaveGetter contract mock up
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.7.6; | |
interface IStableSwapAave { | |
function A_precise() external view returns (uint256); | |
function balances(uint256 i) external view returns (uint256); | |
function underlying_coins(uint256 arg0) external view returns (address); | |
function admin_balances(uint256 arg0) external view returns (uint256); | |
function fee() external view returns (uint256); | |
function offpeg_fee_multiplier() external view returns (uint256); | |
} | |
contract StableSwapAaveGetter { | |
uint256 constant N_COINS = 3; | |
function getState( | |
address poolAddress | |
) external view returns ( | |
uint256 A_precise, | |
uint256 fee, | |
uint256 offpeg_fee_multiplier, | |
uint256 admin_fee, | |
uint256[N_COINS] memory balances | |
) { | |
IStableSwapAave pool = IStableSwapAave(poolAddress); | |
A_precise = pool.A_precise(); | |
fee = pool.fee(); | |
offpeg_fee_multiplier = pool.offpeg_fee_multiplier(); | |
admin_fee = pool.admin_fee(); | |
balances = poolBalances(pool); | |
return (A_precise, fee, offpeg_fee_multiplier, admin_fee, balances); | |
} | |
function poolBalances(IStableSwapAave pool) internal view returns (uint256[N_COINS] memory balz) { | |
for (uint i = 0; i < N_COINS; i++) { | |
balz[i] = pool.balances(i); | |
} | |
return balz; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment