diff --git a/.gitignore b/.gitignore index eba381d..3830ac4 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ build/ reports/ node_modules .build/ +.idea ### Python ### # Byte-compiled / optimized / DLL files diff --git a/contracts/implementations/plain-2/Plain2Price.vy b/contracts/implementations/plain-2/Plain2Price.vy index b291a37..5aaa8f0 100644 --- a/contracts/implementations/plain-2/Plain2Price.vy +++ b/contracts/implementations/plain-2/Plain2Price.vy @@ -334,7 +334,7 @@ def _stored_rates() -> uint256[N_COINS]: oracle: uint256 = self.oracles[i] if oracle == 0: continue - + # NOTE: assumed that response is of precision 10**18 response: Bytes[32] = raw_call( convert(oracle % 2**160, address), @@ -344,9 +344,16 @@ def _stored_rates() -> uint256[N_COINS]: ) assert len(response) != 0 rates[i] = rates[i] * convert(response, uint256) / PRECISION - + return rates + +@view +@external +def stored_rates() -> uint256[N_COINS]: + return self._stored_rates() + + @view @external def get_balances() -> uint256[N_COINS]: @@ -682,7 +689,7 @@ def add_liquidity( fees[i] = base_fee * difference / FEE_DENOMINATOR self.balances[i] = new_balance - (fees[i] * ADMIN_FEE / FEE_DENOMINATOR) new_balances[i] -= fees[i] - + xp: uint256[N_COINS] = self._xp_mem(rates, new_balances) D2: uint256 = self.get_D_mem(rates, new_balances, amp) mint_amount = total_supply * (D2 - D0) / D0 @@ -707,9 +714,9 @@ def add_liquidity( @view @internal def get_y( - i: int128, - j: int128, - x: uint256, + i: int128, + j: int128, + x: uint256, xp: uint256[N_COINS], amp: uint256, D: uint256, diff --git a/contracts/implementations/plain-3/Plain3Price.vy b/contracts/implementations/plain-3/Plain3Price.vy index e704efb..8cf41a0 100644 --- a/contracts/implementations/plain-3/Plain3Price.vy +++ b/contracts/implementations/plain-3/Plain3Price.vy @@ -307,7 +307,7 @@ def _stored_rates() -> uint256[N_COINS]: oracle: uint256 = self.oracles[i] if oracle == 0: continue - + response: Bytes[32] = raw_call( convert(oracle % 2**160, address), _abi_encode(bitwise_and(oracle, BIT_MASK)), @@ -316,10 +316,16 @@ def _stored_rates() -> uint256[N_COINS]: ) assert len(response) != 0 rates[i] = rates[i] * convert(response, uint256) / PRECISION - + return rates +@view +@external +def stored_rates() -> uint256[N_COINS]: + return self._stored_rates() + + @view @external def get_balances() -> uint256[N_COINS]: diff --git a/contracts/implementations/plain-4/Plain4Price.vy b/contracts/implementations/plain-4/Plain4Price.vy index b8c2f78..407817e 100644 --- a/contracts/implementations/plain-4/Plain4Price.vy +++ b/contracts/implementations/plain-4/Plain4Price.vy @@ -307,7 +307,7 @@ def _stored_rates() -> uint256[N_COINS]: oracle: uint256 = self.oracles[i] if oracle == 0: continue - + response: Bytes[32] = raw_call( convert(oracle % 2**160, address), _abi_encode(bitwise_and(oracle, BIT_MASK)), @@ -316,10 +316,16 @@ def _stored_rates() -> uint256[N_COINS]: ) assert len(response) != 0 rates[i] = rates[i] * convert(response, uint256) / PRECISION - + return rates +@view +@external +def stored_rates() -> uint256[N_COINS]: + return self._stored_rates() + + @view @external def get_balances() -> uint256[N_COINS]: