@bancor/contracts-solidity
Advanced tools
Comparing version 0.6.7 to 0.6.8
@@ -0,1 +1,6 @@ | ||
### 0.6.8 (2020-07-31) | ||
Converters | ||
* Updated version number | ||
### 0.6.7 (2020-07-31) | ||
@@ -2,0 +7,0 @@ General |
{ | ||
"name": "@bancor/contracts-solidity", | ||
"version": "0.6.7", | ||
"version": "0.6.8", | ||
"description": "The solidity version of the Bancor smart contracts is composed of many different components that work together to create the Bancor Network deployment.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -141,10 +141,6 @@ const fs = require('fs'); | ||
// main contracts | ||
const contractRegistry = await web3Func(deploy, 'contractRegistry', 'ContractRegistry', []); | ||
const contractRegistryAddress = '0x52Ae12ABe5D8BD778BD5397F99cA900624CfADD4'; | ||
const converterFactory = await web3Func(deploy, 'converterFactory', 'ConverterFactory', []); | ||
const bancorFormula = await web3Func(deploy, 'bancorFormula', 'BancorFormula', []); | ||
const bancorNetwork = await web3Func(deploy, 'bancorNetwork', 'BancorNetwork', [contractRegistry._address]); | ||
const conversionPathFinder = await web3Func(deploy, 'conversionPathFinder', 'ConversionPathFinder', [contractRegistry._address]); | ||
const converterUpgrader = await web3Func(deploy, 'converterUpgrader', 'ConverterUpgrader', [contractRegistry._address, addresses.ETH]); | ||
const converterRegistry = await web3Func(deploy, 'converterRegistry', 'ConverterRegistry', [contractRegistry._address]); | ||
const converterRegistryData = await web3Func(deploy, 'converterRegistryData', 'ConverterRegistryData', [contractRegistry._address]); | ||
const converterUpgrader = await web3Func(deploy, 'converterUpgrader', 'ConverterUpgrader', [contractRegistryAddress, addresses.ETH]); | ||
const liquidTokenConverterFactory = await web3Func(deploy, 'liquidTokenConverterFactory', 'LiquidTokenConverterFactory', []); | ||
@@ -155,3 +151,4 @@ const liquidityPoolV1ConverterFactory = await web3Func(deploy, 'liquidityPoolV1ConverterFactory', 'LiquidityPoolV1ConverterFactory', []); | ||
const liquidityPoolV2ConverterCustomFactory = await web3Func(deploy, 'liquidityPoolV2ConverterCustomFactory', 'LiquidityPoolV2ConverterCustomFactory', []); | ||
const oracleWhitelist = await web3Func(deploy, 'oracleWhitelist', 'Whitelist', []); | ||
await web3Func(deploy, 'oracleWhitelist', 'Whitelist', []); | ||
await web3Func(deploy, 'ethToEthOracle', 'ChainlinkETHToETHOracle', []); | ||
@@ -165,17 +162,6 @@ // contract deployment for etherscan verification only | ||
await web3Func(deploy, 'priceOracle', 'PriceOracle', [smartToken._address, smartToken2._address, chainlinkOracle1._address, chainlinkOracle2._address]); | ||
await web3Func(deploy, 'liquidTokenConverter', 'LiquidTokenConverter', [smartToken._address, converterRegistry._address, 1000]); | ||
await web3Func(deploy, 'liquidityPoolV1Converter', 'LiquidityPoolV1Converter', [smartToken2._address, converterRegistry._address, 1000]); | ||
await web3Func(deploy, 'liquidityPoolV2Converter', 'LiquidityPoolV2Converter', [poolTokensContainer._address, converterRegistry._address, 1000]); | ||
await web3Func(deploy, 'liquidTokenConverter', 'LiquidTokenConverter', [smartToken._address, contractRegistryAddress, 1000]); | ||
await web3Func(deploy, 'liquidityPoolV1Converter', 'LiquidityPoolV1Converter', [smartToken2._address, contractRegistryAddress, 1000]); | ||
await web3Func(deploy, 'liquidityPoolV2Converter', 'LiquidityPoolV2Converter', [poolTokensContainer._address, contractRegistryAddress, 1000]); | ||
// 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('BancorFormula'), bancorFormula._address)); | ||
await execute(contractRegistry.methods.registerAddress(Web3.utils.asciiToHex('BancorNetwork'), bancorNetwork._address)); | ||
await execute(contractRegistry.methods.registerAddress(Web3.utils.asciiToHex('ConversionPathFinder'), conversionPathFinder._address)); | ||
await execute(contractRegistry.methods.registerAddress(Web3.utils.asciiToHex('BancorConverterUpgrader'), converterUpgrader._address)); | ||
await execute(contractRegistry.methods.registerAddress(Web3.utils.asciiToHex('BancorConverterRegistry'), converterRegistry._address)); | ||
await execute(contractRegistry.methods.registerAddress(Web3.utils.asciiToHex('BancorConverterRegistryData'), converterRegistryData._address)); | ||
await execute(contractRegistry.methods.registerAddress(Web3.utils.asciiToHex('ChainlinkOracleWhitelist'), oracleWhitelist._address)); | ||
// initialize converter factory | ||
@@ -188,72 +174,2 @@ await execute(converterFactory.methods.registerTypedConverterFactory(liquidTokenConverterFactory._address)); | ||
for (const reserve of getConfig().reserves) { | ||
if (reserve.address) { | ||
addresses[reserve.symbol] = reserve.address; | ||
tokenDecimals[reserve.symbol] = reserve.decimals; | ||
continue; | ||
} | ||
const name = reserve.symbol + ' ERC20 Token'; | ||
const symbol = reserve.symbol; | ||
const decimals = reserve.decimals; | ||
const supply = decimalToInteger(reserve.supply, decimals); | ||
const token = await web3Func(deploy, 'erc20Token' + symbol, 'ERC20Token', [name, symbol, decimals, supply]); | ||
addresses[reserve.symbol] = token._address; | ||
tokenDecimals[reserve.symbol] = reserve.decimals; | ||
} | ||
for (const converter of getConfig().converters) { | ||
const type = converter.type; | ||
const name = converter.symbol + (type == 0 ? ' Liquid Token' : ' Liquidity Pool'); | ||
const symbol = converter.symbol; | ||
const decimals = converter.decimals; | ||
const fee = percentageToPPM(converter.fee); | ||
const tokens = converter.reserves.map(reserve => addresses[reserve.symbol]); | ||
const weights = converter.reserves.map(reserve => percentageToPPM(reserve.weight)); | ||
const amounts = converter.reserves.map(reserve => decimalToInteger(reserve.balance, tokenDecimals[reserve.symbol])); | ||
const value = amounts[converter.reserves.findIndex(reserve => reserve.symbol === 'ETH')]; | ||
await execute(converterRegistry.methods.newConverter(type, name, symbol, decimals, fee, tokens, weights)); | ||
const anchor = deployed(web3, 'IConverterAnchor', (await converterRegistry.methods.getAnchors().call()).slice(-1)[0]); | ||
const converterBase = deployed(web3, 'ConverterBase', await anchor.methods.owner().call()); | ||
await execute(converterBase.methods.acceptOwnership()); | ||
if (type !== 0 && amounts.every(amount => amount > 0)) { | ||
for (let i = 0; i < converter.reserves.length; i++) { | ||
const reserve = converter.reserves[i]; | ||
if (reserve.symbol !== 'ETH') { | ||
await execute(deployed(web3, 'ERC20Token', tokens[i]).methods.approve(converterBase._address, amounts[i])); | ||
} | ||
if (type == 2) { | ||
if (!reserve.oracle) { | ||
// can be used to deploy test (static) oracles | ||
/* | ||
const chainlinkPriceOracle = await web3Func(deploy, 'chainlinkPriceOracle' + converter.symbol + reserve.symbol, 'ChainlinkETHToETHOracle', []); | ||
reserve.oracle = chainlinkPriceOracle._address; | ||
*/ | ||
} | ||
await execute(oracleWhitelist.methods.addAddress(reserve.oracle)); | ||
} | ||
} | ||
if (type == 1) { | ||
await execute(deployed(web3, 'LiquidityPoolV1Converter', converterBase._address).methods.addLiquidity(tokens, amounts, 1), value); | ||
} | ||
else if (type == 2) { | ||
const deployedConverter = deployed(web3, 'LiquidityPoolV2Converter', converterBase._address); | ||
await execute(deployedConverter.methods.activate(tokens[0], converter.reserves[0].oracle, converter.reserves[1].oracle)); | ||
for (let i = 0; i < converter.reserves.length; i++) { | ||
await execute(deployedConverter.methods.addLiquidity(tokens[i], amounts[i], 1), value); | ||
} | ||
} | ||
} | ||
addresses[converter.symbol] = anchor._address; | ||
} | ||
await execute(contractRegistry.methods.registerAddress(Web3.utils.asciiToHex('BNTToken'), addresses.BNT)); | ||
await execute(conversionPathFinder.methods.setAnchorToken(addresses.BNT)); | ||
await execute(bancorFormula.methods.init()); | ||
@@ -260,0 +176,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2093421
9356