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
[FEAT] Bumps to web3 v6, adds linters, adds tests (pending upstream merge) #55
Open
8ball030
wants to merge
16
commits into
balancer:main
Choose a base branch
from
8ball030:main
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
d3ccf9f
bumped to web6
8ball030 3ef2a33
[feat] deps
4218170
bumped to web3v6
8ball030 0656963
small improvements
8ball030 f858316
reverted testing changes
8ball030 0bcefb4
added test for graph
8ball030 1cc7137
[chore] ensured pep8 compliance
8ball030 5498b3e
[chore] ensured pep8 compliance
8ball030 e55ab2f
[chore] ensured pep8 compliance
8ball030 61c6efd
[chore] added dev deps group
8ball030 98bf435
[chore] added docs
8ball030 521fb53
added test for graph
8ball030 ebb6ac9
[feat] ensured commit matches
8ball030 baedb62
Merge pull request #1 from 8ball030/feat/syncing-changes-2
8ball030 8c1b44f
feat: added base
8ball030 dc7d0d7
feat: added base
8ball030 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +0,0 @@ | ||
from .balancerErrors import handleException | ||
from balpy import balpy | ||
|
||
Submodule balancer-deployments
updated
266 files
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,107 +1,110 @@ | ||
codes = {0:"ADD_OVERFLOW", | ||
1:"SUB_OVERFLOW", | ||
2:"SUB_UNDERFLOW", | ||
3:"MUL_OVERFLOW", | ||
4:"ZERO_DIVISION", | ||
5:"DIV_INTERNAL", | ||
6:"X_OUT_OF_BOUNDS", | ||
7:"Y_OUT_OF_BOUNDS", | ||
8:"PRODUCT_OUT_OF_BOUNDS", | ||
9:"INVALID_EXPONENT", | ||
100:"OUT_OF_BOUNDS", | ||
101:"UNSORTED_ARRAY", | ||
102:"UNSORTED_TOKENS", | ||
103:"INPUT_LENGTH_MISMATCH", | ||
104:"ZERO_TOKEN", | ||
200:"MIN_TOKENS", | ||
201:"MAX_TOKENS", | ||
202:"MAX_SWAP_FEE_PERCENTAGE", | ||
203:"MIN_SWAP_FEE_PERCENTAGE", | ||
204:"MINIMUM_BPT", | ||
205:"CALLER_NOT_VAULT", | ||
206:"UNINITIALIZED", | ||
207:"BPT_IN_MAX_AMOUNT", | ||
208:"BPT_OUT_MIN_AMOUNT", | ||
209:"EXPIRED_PERMIT", | ||
300:"MIN_AMP", | ||
301:"MAX_AMP", | ||
302:"MIN_WEIGHT", | ||
303:"MAX_STABLE_TOKENS", | ||
304:"MAX_IN_RATIO", | ||
305:"MAX_OUT_RATIO", | ||
306:"MIN_BPT_IN_FOR_TOKEN_OUT", | ||
307:"MAX_OUT_BPT_FOR_TOKEN_IN", | ||
308:"NORMALIZED_WEIGHT_INVARIANT", | ||
309:"INVALID_TOKEN", | ||
310:"UNHANDLED_JOIN_KIND", | ||
311:"ZERO_INVARIANT", | ||
400:"REENTRANCY", | ||
401:"SENDER_NOT_ALLOWED", | ||
402:"PAUSED", | ||
403:"PAUSE_WINDOW_EXPIRED", | ||
404:"MAX_PAUSE_WINDOW_DURATION", | ||
405:"MAX_BUFFER_PERIOD_DURATION", | ||
406:"INSUFFICIENT_BALANCE", | ||
407:"INSUFFICIENT_ALLOWANCE", | ||
408:"ERC20_TRANSFER_FROM_ZERO_ADDRESS", | ||
409:"ERC20_TRANSFER_TO_ZERO_ADDRESS", | ||
410:"ERC20_MINT_TO_ZERO_ADDRESS", | ||
411:"ERC20_BURN_FROM_ZERO_ADDRESS", | ||
412:"ERC20_APPROVE_FROM_ZERO_ADDRESS", | ||
413:"ERC20_APPROVE_TO_ZERO_ADDRESS", | ||
414:"ERC20_TRANSFER_EXCEEDS_ALLOWANCE", | ||
415:"ERC20_DECREASED_ALLOWANCE_BELOW_ZERO", | ||
416:"ERC20_TRANSFER_EXCEEDS_BALANCE", | ||
417:"ERC20_BURN_EXCEEDS_ALLOWANCE", | ||
418:"SAFE_ERC20_CALL_FAILED", | ||
419:"ADDRESS_INSUFFICIENT_BALANCE", | ||
420:"ADDRESS_CANNOT_SEND_VALUE", | ||
421:"SAFE_CAST_VALUE_CANT_FIT_INT256", | ||
422:"GRANT_SENDER_NOT_ADMIN", | ||
423:"REVOKE_SENDER_NOT_ADMIN", | ||
424:"RENOUNCE_SENDER_NOT_ALLOWED", | ||
425:"BUFFER_PERIOD_EXPIRED", | ||
500:"INVALID_POOL_ID", | ||
501:"CALLER_NOT_POOL", | ||
502:"SENDER_NOT_ASSET_MANAGER", | ||
503:"USER_DOESNT_ALLOW_RELAYER", | ||
504:"INVALID_SIGNATURE", | ||
505:"EXIT_BELOW_MIN", | ||
506:"JOIN_ABOVE_MAX", | ||
507:"SWAP_LIMIT", | ||
508:"SWAP_DEADLINE", | ||
509:"CANNOT_SWAP_SAME_TOKEN", | ||
510:"UNKNOWN_AMOUNT_IN_FIRST_SWAP", | ||
511:"MALCONSTRUCTED_MULTIHOP_SWAP", | ||
512:"INTERNAL_BALANCE_OVERFLOW", | ||
513:"INSUFFICIENT_INTERNAL_BALANCE", | ||
514:"INVALID_ETH_INTERNAL_BALANCE", | ||
515:"INVALID_POST_LOAN_BALANCE", | ||
516:"INSUFFICIENT_ETH", | ||
517:"UNALLOCATED_ETH", | ||
518:"ETH_TRANSFER", | ||
519:"CANNOT_USE_ETH_SENTINEL", | ||
520:"TOKENS_MISMATCH", | ||
521:"TOKEN_NOT_REGISTERED", | ||
522:"TOKEN_ALREADY_REGISTERED", | ||
523:"TOKENS_ALREADY_SET", | ||
524:"TOKENS_LENGTH_MUST_BE_2", | ||
525:"NONZERO_TOKEN_BALANCE", | ||
526:"BALANCE_TOTAL_OVERFLOW", | ||
600:"SWAP_FEE_PERCENTAGE_TOO_HIGH", | ||
601:"FLASH_LOAN_FEE_PERCENTAGE_TOO_HIGH", | ||
602:"INSUFFICIENT_FLASH_LOAN_FEE_AMOUNT" | ||
}; | ||
codes = { | ||
0: "ADD_OVERFLOW", | ||
1: "SUB_OVERFLOW", | ||
2: "SUB_UNDERFLOW", | ||
3: "MUL_OVERFLOW", | ||
4: "ZERO_DIVISION", | ||
5: "DIV_INTERNAL", | ||
6: "X_OUT_OF_BOUNDS", | ||
7: "Y_OUT_OF_BOUNDS", | ||
8: "PRODUCT_OUT_OF_BOUNDS", | ||
9: "INVALID_EXPONENT", | ||
100: "OUT_OF_BOUNDS", | ||
101: "UNSORTED_ARRAY", | ||
102: "UNSORTED_TOKENS", | ||
103: "INPUT_LENGTH_MISMATCH", | ||
104: "ZERO_TOKEN", | ||
200: "MIN_TOKENS", | ||
201: "MAX_TOKENS", | ||
202: "MAX_SWAP_FEE_PERCENTAGE", | ||
203: "MIN_SWAP_FEE_PERCENTAGE", | ||
204: "MINIMUM_BPT", | ||
205: "CALLER_NOT_VAULT", | ||
206: "UNINITIALIZED", | ||
207: "BPT_IN_MAX_AMOUNT", | ||
208: "BPT_OUT_MIN_AMOUNT", | ||
209: "EXPIRED_PERMIT", | ||
300: "MIN_AMP", | ||
301: "MAX_AMP", | ||
302: "MIN_WEIGHT", | ||
303: "MAX_STABLE_TOKENS", | ||
304: "MAX_IN_RATIO", | ||
305: "MAX_OUT_RATIO", | ||
306: "MIN_BPT_IN_FOR_TOKEN_OUT", | ||
307: "MAX_OUT_BPT_FOR_TOKEN_IN", | ||
308: "NORMALIZED_WEIGHT_INVARIANT", | ||
309: "INVALID_TOKEN", | ||
310: "UNHANDLED_JOIN_KIND", | ||
311: "ZERO_INVARIANT", | ||
400: "REENTRANCY", | ||
401: "SENDER_NOT_ALLOWED", | ||
402: "PAUSED", | ||
403: "PAUSE_WINDOW_EXPIRED", | ||
404: "MAX_PAUSE_WINDOW_DURATION", | ||
405: "MAX_BUFFER_PERIOD_DURATION", | ||
406: "INSUFFICIENT_BALANCE", | ||
407: "INSUFFICIENT_ALLOWANCE", | ||
408: "ERC20_TRANSFER_FROM_ZERO_ADDRESS", | ||
409: "ERC20_TRANSFER_TO_ZERO_ADDRESS", | ||
410: "ERC20_MINT_TO_ZERO_ADDRESS", | ||
411: "ERC20_BURN_FROM_ZERO_ADDRESS", | ||
412: "ERC20_APPROVE_FROM_ZERO_ADDRESS", | ||
413: "ERC20_APPROVE_TO_ZERO_ADDRESS", | ||
414: "ERC20_TRANSFER_EXCEEDS_ALLOWANCE", | ||
415: "ERC20_DECREASED_ALLOWANCE_BELOW_ZERO", | ||
416: "ERC20_TRANSFER_EXCEEDS_BALANCE", | ||
417: "ERC20_BURN_EXCEEDS_ALLOWANCE", | ||
418: "SAFE_ERC20_CALL_FAILED", | ||
419: "ADDRESS_INSUFFICIENT_BALANCE", | ||
420: "ADDRESS_CANNOT_SEND_VALUE", | ||
421: "SAFE_CAST_VALUE_CANT_FIT_INT256", | ||
422: "GRANT_SENDER_NOT_ADMIN", | ||
423: "REVOKE_SENDER_NOT_ADMIN", | ||
424: "RENOUNCE_SENDER_NOT_ALLOWED", | ||
425: "BUFFER_PERIOD_EXPIRED", | ||
500: "INVALID_POOL_ID", | ||
501: "CALLER_NOT_POOL", | ||
502: "SENDER_NOT_ASSET_MANAGER", | ||
503: "USER_DOESNT_ALLOW_RELAYER", | ||
504: "INVALID_SIGNATURE", | ||
505: "EXIT_BELOW_MIN", | ||
506: "JOIN_ABOVE_MAX", | ||
507: "SWAP_LIMIT", | ||
508: "SWAP_DEADLINE", | ||
509: "CANNOT_SWAP_SAME_TOKEN", | ||
510: "UNKNOWN_AMOUNT_IN_FIRST_SWAP", | ||
511: "MALCONSTRUCTED_MULTIHOP_SWAP", | ||
512: "INTERNAL_BALANCE_OVERFLOW", | ||
513: "INSUFFICIENT_INTERNAL_BALANCE", | ||
514: "INVALID_ETH_INTERNAL_BALANCE", | ||
515: "INVALID_POST_LOAN_BALANCE", | ||
516: "INSUFFICIENT_ETH", | ||
517: "UNALLOCATED_ETH", | ||
518: "ETH_TRANSFER", | ||
519: "CANNOT_USE_ETH_SENTINEL", | ||
520: "TOKENS_MISMATCH", | ||
521: "TOKEN_NOT_REGISTERED", | ||
522: "TOKEN_ALREADY_REGISTERED", | ||
523: "TOKENS_ALREADY_SET", | ||
524: "TOKENS_LENGTH_MUST_BE_2", | ||
525: "NONZERO_TOKEN_BALANCE", | ||
526: "BALANCE_TOTAL_OVERFLOW", | ||
600: "SWAP_FEE_PERCENTAGE_TOO_HIGH", | ||
601: "FLASH_LOAN_FEE_PERCENTAGE_TOO_HIGH", | ||
602: "INSUFFICIENT_FLASH_LOAN_FEE_AMOUNT", | ||
} | ||
|
||
|
||
def translateError(code): | ||
return(codes[code]) | ||
return codes[code] | ||
|
||
|
||
def handleException(error): | ||
stringError = str('{}'.format(error)); | ||
if "BAL#" in stringError: | ||
Comment on lines
-100
to
-101
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mixed tabs and whitespaces |
||
code = int(stringError.split("BAL#")[1]) | ||
balError = translateError(code); | ||
descriptiveError = "Balancer Smart Contract threw error: " + balError; | ||
return(descriptiveError); | ||
else: | ||
return(stringError); | ||
stringError = str("{}".format(error)) | ||
if "BAL#" in stringError: | ||
code = int(stringError.split("BAL#")[1]) | ||
balError = translateError(code) | ||
descriptiveError = "Balancer Smart Contract threw error: " + balError | ||
return descriptiveError | ||
else: | ||
return stringError |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
from decimal import Decimal | ||
|
||
|
||
BONE = Decimal('1') | ||
MIN_FEE = Decimal('0.000001') | ||
MAX_FEE = Decimal('0.1') | ||
INIT_POOL_SUPPLY = BONE * Decimal('100') | ||
BONE = Decimal("1") | ||
MIN_FEE = Decimal("0.000001") | ||
MAX_FEE = Decimal("0.1") | ||
INIT_POOL_SUPPLY = BONE * Decimal("100") | ||
MIN_BOUND_TOKENS = 2 | ||
MAX_BOUND_TOKENS = 8 | ||
AMPLIFICATION_PARAMETER = Decimal('200') | ||
AMPLIFICATION_PARAMETER = Decimal("200") | ||
MIN_WEIGHT = 0.01 | ||
_MAX_WEIGHTED_TOKENS = 100 | ||
_MAX_IN_RATIO = 0.3 | ||
_MAX_OUT_RATIO = 0.3 | ||
_MAX_INVARIANT_RATIO = 3 | ||
_MIN_INVARIANT_RATIO = 0.7 | ||
_MIN_INVARIANT_RATIO = 0.7 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not in the docs atm, might need to add the compile step too