Skip to content

Commit

Permalink
deploy new ng implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
bout3fiddy committed Nov 14, 2023
1 parent e681684 commit 9228406
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 29 deletions.
58 changes: 29 additions & 29 deletions scripts/deploy_infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"ethereum:mainnet": {
"math": "0x20D1c021525C85D9617Ccc64D8f547d5f730118A",
"views": "0x87DD13Dd25a1DBde0E1EdcF5B8Fa6cfff7eABCaD",
"plain_amm": "0x3E3B5F27bbf5CC967E074b70E9f4046e31663181",
"plain_amm": "0x933f4769DCC27fC7345D9d5975AE48EC4D0F829C",
"meta_amm": "0x64AFA95e0C3D8410240a4262df9Fd82B12b64eDd",
"factory": "0x6A8cbed756804B16E05E741eDaBd5cB544AE21bf",
"gauge": "0xf2eff2Cd0d9C82b7b2f17FbBed703fA7931dB1da",
Expand All @@ -32,36 +32,36 @@
"arbitrum:mainnet": {
"math": "0x3d6cB2F6DcF47CDd9C13E4e3beAe9af041d8796a",
"views": "0xC1b393EfEF38140662b91441C6710Aa704973228",
"plain_amm": "0x76303e4fDcA0AbF28aB3ee42Ce086E6503431F1D",
"meta_amm": "0xd125E7a0cEddF89c6473412d85835450897be6Dc",
"plain_amm": "",
"meta_amm": "",
"factory": "0x9AF14D26075f142eb3F292D5065EB3faa646167b",
},
"optimism:mainnet": {
"math": "0x8b3EFBEfa6eD222077455d6f0DCdA3bF4f3F57A6",
"views": "0x506F594ceb4E33F5161139bAe3Ee911014df9f7f",
"plain_amm": "0x87FE17697D0f14A222e8bEf386a0860eCffDD617",
"meta_amm": "0x1764ee18e8B3ccA4787249Ceb249356192594585",
"plain_amm": "",
"meta_amm": "",
"factory": "0x5eeE3091f747E60a045a2E715a4c71e600e31F6E",
},
"base:mainnet": {
"math": "0x506F594ceb4E33F5161139bAe3Ee911014df9f7f",
"views": "0x87FE17697D0f14A222e8bEf386a0860eCffDD617",
"plain_amm": "0x1764ee18e8B3ccA4787249Ceb249356192594585",
"meta_amm": "0x5eee3091f747e60a045a2e715a4c71e600e31f6e",
"plain_amm": "",
"meta_amm": "",
"factory": "0xd2002373543Ce3527023C75e7518C274A51ce712",
},
"linea:mainnet": {
"math": "0x8b3EFBEfa6eD222077455d6f0DCdA3bF4f3F57A6",
"views": "0x506F594ceb4E33F5161139bAe3Ee911014df9f7f",
"plain_amm": "0x87FE17697D0f14A222e8bEf386a0860eCffDD617",
"meta_amm": "0x1764ee18e8b3cca4787249ceb249356192594585",
"plain_amm": "",
"meta_amm": "",
"factory": "0x5eeE3091f747E60a045a2E715a4c71e600e31F6E",
},
"scroll:mainnet": {
"math": "0x8b3EFBEfa6eD222077455d6f0DCdA3bF4f3F57A6",
"views": "0x506F594ceb4E33F5161139bAe3Ee911014df9f7f",
"plain_amm": "0x87FE17697D0f14A222e8bEf386a0860eCffDD617",
"meta_amm": "0x1764ee18e8B3ccA4787249Ceb249356192594585",
"plain_amm": "",
"meta_amm": "",
"factory": "0x5eeE3091f747E60a045a2E715a4c71e600e31F6E",
},
"zksync:mainnet": {
Expand All @@ -74,65 +74,65 @@
"pzkevm:mainnet": {
"math": "0x506F594ceb4E33F5161139bAe3Ee911014df9f7f",
"views": "0x87fe17697d0f14a222e8bef386a0860ecffdd617",
"plain_amm": "0x1764ee18e8b3cca4787249ceb249356192594585",
"meta_amm": "0x5eee3091f747e60a045a2e715a4c71e600e31f6e",
"plain_amm": "",
"meta_amm": "",
"factory": "0xd2002373543Ce3527023C75e7518C274A51ce712",
},
# Layer 1
"gnosis:mainnet": {
"math": "0x87FE17697D0f14A222e8bEf386a0860eCffDD617",
"views": "0x5eeE3091f747E60a045a2E715a4c71e600e31F6E",
"plain_amm": "0xd2002373543Ce3527023C75e7518C274A51ce712",
"meta_amm": "0xd3B17f862956464ae4403cCF829CE69199856e1e",
"plain_amm": "",
"meta_amm": "",
"factory": "0xbC0797015fcFc47d9C1856639CaE50D0e69FbEE8",
},
"polygon:mainnet": {
"math": "0xf3A431008396df8A8b2DF492C913706BDB0874ef",
"views": "0x8b3EFBEfa6eD222077455d6f0DCdA3bF4f3F57A6",
"plain_amm": "0x506F594ceb4E33F5161139bAe3Ee911014df9f7f",
"meta_amm": "0x87FE17697D0f14A222e8bEf386a0860eCffDD617",
"plain_amm": "",
"meta_amm": "",
"factory": "0x1764ee18e8B3ccA4787249Ceb249356192594585",
},
"avax:mainnet": {
"math": "0xf3A431008396df8A8b2DF492C913706BDB0874ef",
"views": "0x8b3EFBEfa6eD222077455d6f0DCdA3bF4f3F57A6",
"plain_amm": "0x506F594ceb4E33F5161139bAe3Ee911014df9f7f",
"meta_amm": "0x87FE17697D0f14A222e8bEf386a0860eCffDD617",
"plain_amm": "",
"meta_amm": "",
"factory": "0x1764ee18e8B3ccA4787249Ceb249356192594585",
},
"ftm:mainnet": {
"math": "0x8b3EFBEfa6eD222077455d6f0DCdA3bF4f3F57A6",
"views": "0x5eeE3091f747E60a045a2E715a4c71e600e31F6E",
"plain_amm": "0xd2002373543Ce3527023C75e7518C274A51ce712",
"meta_amm": "0x686bdb3D24Bc6F3ED89ed3d3B659765c54aC78B4",
"plain_amm": "",
"meta_amm": "",
"factory": "0xe61Fb97Ef6eBFBa12B36Ffd7be785c1F5A2DE66b",
},
"bsc:mainnet": {
"math": "0x506F594ceb4E33F5161139bAe3Ee911014df9f7f",
"views": "0x1764ee18e8B3ccA4787249Ceb249356192594585",
"plain_amm": "0x604388Bb1159AFd21eB5191cE22b4DeCdEE2Ae22",
"meta_amm": "0x06452f9c013fc37169B57Eab8F50A7A48c9198A3",
"plain_amm": "",
"meta_amm": "",
"factory": "0xd7E72f3615aa65b92A4DBdC211E296a35512988B",
},
"celo:mainnet": {
"math": "0xf3A431008396df8A8b2DF492C913706BDB0874ef",
"views": "0x8b3EFBEfa6eD222077455d6f0DCdA3bF4f3F57A6",
"plain_amm": "0x506F594ceb4E33F5161139bAe3Ee911014df9f7f",
"meta_amm": "0x87FE17697D0f14A222e8bEf386a0860eCffDD617",
"plain_amm": "",
"meta_amm": "",
"factory": "0x1764ee18e8B3ccA4787249Ceb249356192594585",
},
"kava:mainnet": {
"math": "0xf3A431008396df8A8b2DF492C913706BDB0874ef",
"views": "0x8b3EFBEfa6eD222077455d6f0DCdA3bF4f3F57A6",
"plain_amm": "0x506F594ceb4E33F5161139bAe3Ee911014df9f7f",
"meta_amm": "0x87FE17697D0f14A222e8bEf386a0860eCffDD617",
"plain_amm": "",
"meta_amm": "",
"factory": "0x1764ee18e8B3ccA4787249Ceb249356192594585",
},
"aurora:mainnet": {
"math": "0x8b3EFBEfa6eD222077455d6f0DCdA3bF4f3F57A6",
"views": "0x506F594ceb4E33F5161139bAe3Ee911014df9f7f",
"plain_amm": "0x87FE17697D0f14A222e8bEf386a0860eCffDD617",
"meta_amm": "0x1764ee18e8B3ccA4787249Ceb249356192594585",
"plain_amm": "",
"meta_amm": "",
"factory": "0x5eeE3091f747E60a045a2E715a4c71e600e31F6E",
},
"tron:mainnet": {
Expand Down
37 changes: 37 additions & 0 deletions tests/test_oracles.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,43 @@ def test_price_ema(swap, bob, pool_tokens, underlying_tokens, decimals, amount,
assert approx(swap.price_oracle(n), p1, 1e-5)


@given(
amount=strategy("uint256", min_value=10**9, max_value=10**15),
)
@settings(**SETTINGS)
@pytest.mark.only_for_pool_type(0)
def test_manipulate_ema(swap, bob, pool_tokens, underlying_tokens, decimals, amount):

for token in pool_tokens:
if "IS_UP" in token._immutables.__dict__.keys() and not token._immutables.IS_UP:
return

p_oracle_before = swap.price_oracle(0)
print("before", p_oracle_before)

# calc amount in:
amount_in = amount * 10 ** (decimals[0])

# mint tokens for bob if he needs:
if amount_in > pool_tokens[0].balanceOf(bob):
mint_for_testing(bob, amount_in, pool_tokens[0], False)

# do large swap
try:
swap.exchange(0, 1, amount_in, 0, sender=bob)
except boa.BoaError:
return # we're okay with failure to manipulate here

# time travel
boa.env.time_travel(blocks=500)

# check if price oracle is way too high
p_oracle_after = swap.price_oracle(0)
print("after", p_oracle_after)

assert p_oracle_after < 2 * 10**18


@given(
amount=strategy("uint256", min_value=1, max_value=10**5),
dt0=strategy("uint256", min_value=0, max_value=10**6),
Expand Down

0 comments on commit 9228406

Please sign in to comment.