-
Notifications
You must be signed in to change notification settings - Fork 4
V1 pool oracle #31
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
V1 pool oracle #31
Conversation
solidity/contracts/converter/types/liquidity-pool-v1/LiquidityPoolV1Converter.sol
Outdated
Show resolved
Hide resolved
| const contractRegistry = await web3Func(deploy, "contractRegistry", "ContractRegistry", []); | ||
| const converterFactory = await web3Func(deploy, "converterFactory", "ConverterFactory", []); | ||
| const sovrynSwapFormula = await web3Func(deploy, "sovrynSwapFormula", "SovrynSwapFormula", []); | ||
| const sovrynSwapNetwork = await web3Func(deploy, "sovrynSwapNetwork", "SovrynSwapNetwork", [contractRegistry._address]); | ||
| const converterUpgrader = await web3Func(deploy, "converterUpgrader", "ConverterUpgrader", [contractRegistry._address, addresses.ETH]); | ||
| const converterRegistry = await web3Func(deploy, "converterRegistry", "ConverterRegistry", [contractRegistry._address]); | ||
| const liquidityPoolV1ConverterFactory = await web3Func(deploy, "liquidityPoolV1ConverterFactory", "LiquidityPoolV1ConverterFactory", []); | ||
| const smartToken = await web3Func(deploy, "smartToken", "SmartToken", ["TOKEN", "TKN", 1]); | ||
| const oracle = await web3Func(deploy, "oracle", "Oracle", []); | ||
| const liquidityPoolV1Converter = await web3Func(deploy, "liquidityPoolV1Converter", "LiquidityPoolV1Converter", [smartToken._address, contractRegistry._address, MAX_CONVERSION_FEE]); | ||
|
|
||
| //init sovryn swap formula | ||
| await execute(sovrynSwapFormula.methods.init()); | ||
|
|
||
| // initialize contract registry | ||
| await execute(contractRegistry.methods.registerAddress(Web3.utils.asciiToHex("ContractRegistry"), contractRegistry._address)); | ||
| await execute(contractRegistry.methods.registerAddress(Web3.utils.asciiToHex("ConverterFactory"), converterFactory._address)); | ||
| await execute(contractRegistry.methods.registerAddress(Web3.utils.asciiToHex("SovrynSwapFormula"), sovrynSwapFormula._address)); | ||
| await execute(contractRegistry.methods.registerAddress(Web3.utils.asciiToHex("SovrynSwapNetwork"), sovrynSwapNetwork._address)); | ||
| await execute(contractRegistry.methods.registerAddress(Web3.utils.asciiToHex("SovrynSwapConverterUpgrader"), converterUpgrader._address)); | ||
| await execute(contractRegistry.methods.registerAddress(Web3.utils.asciiToHex("SovrynSwapConverterRegistry"), converterRegistry._address)); | ||
|
|
||
| // initialize converter factory | ||
| await execute(converterFactory.methods.registerTypedConverterFactory(liquidityPoolV1ConverterFactory._address)); |
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.
why?
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.
Do you mean this script not needed and I should add the oracle deployment to the test_deployment_rsk.js script?
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.
i mean why would you register all of these addresses again although they already have been registered on deployment?
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.
Oh okay. Adding oracle deployment to addConverter.js so this won't be needed.
solidity/contracts/converter/types/liquidity-pool-v1/LiquidityPoolV1Converter.sol
Outdated
Show resolved
Hide resolved
solidity/contracts/converter/types/liquidity-pool-v1/LiquidityPoolV1Converter.sol
Show resolved
Hide resolved
|
approved with one comment. |
|
would also be nice if
(the script is in an unmerged PR. we can't merge the whole PR, but you can copy the script) |
korepkorep
left a comment
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.
Several code quality issues that don't endanger contracts` security
solidity/contracts/converter/types/liquidity-pool-v1/LiquidityPoolV1Converter.sol
Outdated
Show resolved
Hide resolved
solidity/contracts/converter/types/liquidity-pool-v1/LiquidityPoolV1ConverterMultiAsset.sol
Outdated
Show resolved
Hide resolved
|
|
||
| // ensure that the trade won't deplete the reserve balance | ||
| uint256 targetReserveBalance = reserveBalance(_targetToken); | ||
| assert(amount < targetReserveBalance); |
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.
Using of assert in production source code is not the best practice. Same for other assert cases
|
|
||
| uint256[] memory reserveMinReturnAmounts = new uint256[](reserveTokens.length); | ||
| for (uint256 i = 0; i < reserveMinReturnAmounts.length; i++) | ||
| reserveMinReturnAmounts[i] = 1; |
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.
no protection from slippage
solidity/contracts/converter/types/liquidity-pool-v1/LiquidityPoolV1ConverterMultiAsset.sol
Show resolved
Hide resolved
| // transfer funds from the caller in the reserve token | ||
| if (reserveToken == ETH_RESERVE_ADDRESS) { | ||
| if (msg.value > reserveAmount) { | ||
| msg.sender.transfer(msg.value - reserveAmount); |
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.
Some contracts may revert ether transfers due to lack of gas. Same for other .transfer cases
eMarchenko
left a comment
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.
@korepkorep has performed the review, no security issues have been discovered
…ship Multisig Pool Ownership
No description provided.