Skip to content
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

Migration tool #21

Merged
merged 178 commits into from
Sep 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
178 commits
Select commit Hold shift + click to select a range
ed706c8
Initial commit
sshmaxime Jun 29, 2021
c07d1b3
Merge branch 'master' of github.com:bancorprotocol/contracts-v3 into …
sshmaxime Jun 29, 2021
13342ef
Rework architecture + adding docs
sshmaxime Jun 29, 2021
eef9a6b
Update README.md + few folder organizations
sshmaxime Jun 30, 2021
bfd5ccb
Merge branch 'master' of github.com:bancorprotocol/contracts-v3 into …
sshmaxime Jun 30, 2021
36550b2
Architecture folder reorg + add info to README
sshmaxime Jun 30, 2021
c550026
README.md correction
sshmaxime Jun 30, 2021
e1ba9a4
Merge branch 'master' of github.com:bancorprotocol/contracts-v3 into …
sshmaxime Jul 5, 2021
9039d24
Minor fixes
sshmaxime Jul 5, 2021
8cd399b
Few fixes
sshmaxime Jul 5, 2021
961116d
Update README.md
sshmaxime Jul 6, 2021
910e146
add description to readme.md
sshmaxime Jul 6, 2021
ed939e8
Fixed issues + renamed files + change forking methods
sshmaxime Jul 19, 2021
2fa84e8
Merge branch 'master' of github.com:bancorprotocol/contracts-v3 into …
sshmaxime Jul 19, 2021
aeb5b5a
Merge branch 'master' of github.com:bancorprotocol/contracts-v3 into …
sshmaxime Jul 19, 2021
820d1e2
Architecture re organization + improvement for fork used + bunch of o…
sshmaxime Jul 20, 2021
e4635f1
update config.json in readme
sshmaxime Jul 20, 2021
7ddaad0
Added mainnet network info + optimization + better handling of migrat…
sshmaxime Jul 21, 2021
23d65ef
Fix issues + update README.md + optimizations
sshmaxime Jul 22, 2021
b38e48f
Add proxy to engine + add initial contract migrations
sshmaxime Jul 23, 2021
b454232
pass deploy & execute to initProxy
sshmaxime Jul 23, 2021
23dde3d
fix typos
sshmaxime Jul 25, 2021
771ce17
optimization of network forking use
sshmaxime Jul 26, 2021
5a28679
Add log default param + added atomical initialization
sshmaxime Jul 27, 2021
8501645
Typos + quick fixes
sshmaxime Jul 27, 2021
a20d5d9
few typos + readme.md updates
sshmaxime Jul 27, 2021
1e418c4
typos
sshmaxime Jul 27, 2021
7366b93
separate initial contract migration to several ones
sshmaxime Jul 27, 2021
a4ce37a
Add healthcheck for each migration
sshmaxime Jul 28, 2021
2ee78d5
fix log errors
sshmaxime Jul 28, 2021
05da0c8
fix typos filename
sshmaxime Jul 28, 2021
935a392
fix typos filename
sshmaxime Jul 28, 2021
dc7af33
fix migration + optimization + update hh typechain
sshmaxime Jul 29, 2021
417bb18
add migration errors + typos
sshmaxime Jul 29, 2021
454c0c3
improve code architecture
sshmaxime Jul 30, 2021
5719a90
re-architecture + put tasks in specific folder outside engine
sshmaxime Jul 30, 2021
11959cc
typos fix
sshmaxime Jul 30, 2021
7e3b068
Add down to migration
sshmaxime Jul 30, 2021
f80df80
few updates
sshmaxime Jul 30, 2021
5d48407
fix error due to london fork + fix typos + merge master
sshmaxime Aug 5, 2021
831f67a
update yarn.lock
sshmaxime Aug 8, 2021
602cfb3
WIP: fix errors due to typechain
sshmaxime Aug 8, 2021
3d81df3
merge with master
sshmaxime Aug 8, 2021
7b1a041
add deploy basics contracts migration + update mainnet state + add to…
sshmaxime Aug 10, 2021
926c41e
put comments to the norm
sshmaxime Aug 10, 2021
8fad5f4
fix dependency problem with @bancor/token-governance
sshmaxime Aug 11, 2021
c626bd1
typos fix + update hh config
sshmaxime Aug 12, 2021
a729a83
Update forking description
sshmaxime Aug 23, 2021
d7a2c5b
WIP: typos
sshmaxime Aug 23, 2021
3478a61
fix typos + add revert logic
sshmaxime Aug 23, 2021
2310399
fix revert mechanism
sshmaxime Aug 24, 2021
4e8fc90
fix typos + improve log function
sshmaxime Aug 26, 2021
2594e5b
remove custom errors on migration executions
sshmaxime Aug 26, 2021
f5411ab
typos
sshmaxime Aug 30, 2021
3cba5a1
update throw errors + typos + add upgradeProxy
sshmaxime Aug 30, 2021
d6484af
Improve logs
sshmaxime Aug 31, 2021
9782367
Add upgrade network settings
sshmaxime Sep 1, 2021
08ce64e
merge master into branch
sshmaxime Sep 1, 2021
94d7675
fix revert to last success
sshmaxime Sep 1, 2021
fee573f
remove useless log
sshmaxime Sep 1, 2021
f21746e
re-architecture
sshmaxime Sep 2, 2021
d32024b
update readme.md
sshmaxime Sep 2, 2021
0f61f14
pass migration config to healthcheck in order to act healthcheck base…
sshmaxime Sep 2, 2021
14666e1
typos
sshmaxime Sep 2, 2021
d0ecada
add abi and bytecode in contract builder
sshmaxime Sep 3, 2021
66451b8
Re-architecture of the migration tool in order to facilitate development
sshmaxime Sep 7, 2021
e00bc84
healthcheck of engine in function
sshmaxime Sep 7, 2021
08295d8
fix reset not working due to engine
sshmaxime Sep 7, 2021
b5340a4
WIP: improve migration management + add ABI + bytecode storage on con…
sshmaxime Sep 7, 2021
9d552db
improved class + split deployment by migrations
sshmaxime Sep 8, 2021
f6781bc
update readme
sshmaxime Sep 8, 2021
b45cef9
add loader
sshmaxime Sep 8, 2021
3c87a16
fix: add loader
sshmaxime Sep 8, 2021
239c971
add feature in readme
sshmaxime Sep 8, 2021
5024dd6
add word list ability to create migrations + improve overall architec…
sshmaxime Sep 9, 2021
1c5ee4c
add tests + fix typos + add custom console
sshmaxime Sep 12, 2021
9046ab0
fix logging
sshmaxime Sep 12, 2021
0774074
Add migration exemples + add rinkeby data folder + update README.md +…
sshmaxime Sep 14, 2021
79b8ea0
update token-governance dep + improve extended config + add readme.md…
sshmaxime Sep 15, 2021
281ea01
few fixes
sshmaxime Sep 16, 2021
f454996
remove useless exemples + remove custom timestamp + renamed files wit…
sshmaxime Sep 17, 2021
c102576
change error message
sshmaxime Sep 18, 2021
4e6bcc4
Don't continue the migration after a reset
lbeder Sep 18, 2021
a42bea1
constant --> Constants
lbeder Sep 18, 2021
ab15b1e
Temp rename
lbeder Sep 18, 2021
9c80e0e
engine --> Engine
lbeder Sep 18, 2021
c27262a
Refactor
lbeder Sep 18, 2021
b7af9f1
Temp rename
lbeder Sep 18, 2021
b0626fb
executionFunctions --> ExecutionFunctions
lbeder Sep 18, 2021
fc3cc69
Refactor
lbeder Sep 18, 2021
17c1753
Style
lbeder Sep 18, 2021
49aaadb
Temp rename
lbeder Sep 18, 2021
1b637a6
Replacer + style
lbeder Sep 18, 2021
88627f6
Temp rename
lbeder Sep 18, 2021
b754723
Capitalize
lbeder Sep 18, 2021
843fe0e
Style
lbeder Sep 18, 2021
b4c711f
Temp rename
lbeder Sep 18, 2021
3491d9e
Capitalize
lbeder Sep 18, 2021
38823f5
Style
lbeder Sep 18, 2021
a4c005e
Temp rename
lbeder Sep 18, 2021
9c528e1
Capitalize
lbeder Sep 18, 2021
e1fc2ef
Style
lbeder Sep 18, 2021
4689fef
Temp rename
lbeder Sep 18, 2021
87447fa
Capitalize
lbeder Sep 18, 2021
e66a53c
Temp rename
lbeder Sep 18, 2021
296017f
Capitalize
lbeder Sep 18, 2021
c9645eb
Style
lbeder Sep 18, 2021
ec58f26
FOLDER --> DIR
lbeder Sep 18, 2021
9a9a279
FOLDER --> DIR
lbeder Sep 18, 2021
2feb578
Refactor
lbeder Sep 18, 2021
21b4815
Style
lbeder Sep 18, 2021
e5389ed
Style
lbeder Sep 18, 2021
5b36fc9
exemples --> examples
lbeder Sep 18, 2021
d602116
Style
lbeder Sep 18, 2021
affef12
Style
lbeder Sep 18, 2021
97b141f
Temp rename
lbeder Sep 18, 2021
690c3b3
Capitalize
lbeder Sep 18, 2021
2a35e1b
Style
lbeder Sep 18, 2021
f9f8949
Temp rename
lbeder Sep 18, 2021
97bec05
Capitalize
lbeder Sep 18, 2021
2ec65c6
Temp rename
lbeder Sep 18, 2021
3735cfd
Capitalize
lbeder Sep 18, 2021
f70e073
ExecutionFunctions --> Execution
lbeder Sep 18, 2021
1df4f5f
Style
lbeder Sep 18, 2021
85fbc2c
Rename
lbeder Sep 18, 2021
c3a574c
Style
lbeder Sep 18, 2021
1382ee4
Style
lbeder Sep 18, 2021
f2e7f1e
Temp rename
lbeder Sep 18, 2021
90c4766
Capitalize
lbeder Sep 18, 2021
01af55b
Rename
lbeder Sep 18, 2021
de239b5
Style
lbeder Sep 18, 2021
4534c36
Style
lbeder Sep 18, 2021
4659d09
Style
lbeder Sep 18, 2021
26b2b90
Merge branch 'migration_tool' into migration-tool-refactor
lbeder Sep 18, 2021
bc7fcf4
Style
lbeder Sep 18, 2021
d7b2498
Fix tests
lbeder Sep 18, 2021
8f2f4c3
Fix loop
lbeder Sep 18, 2021
ca987c3
Combine reset and migrate
lbeder Sep 19, 2021
f63a70a
Typo
lbeder Sep 19, 2021
946e27b
Folder --> Dir
lbeder Sep 19, 2021
2df56bd
initializeFctName --> initializeFunction
lbeder Sep 19, 2021
8859a07
Remove pathToRoot
lbeder Sep 19, 2021
c192a26
Copy
lbeder Sep 19, 2021
cac8af0
Copy
lbeder Sep 19, 2021
c1f2661
Copy
lbeder Sep 19, 2021
f210f30
Copy
lbeder Sep 19, 2021
6879f68
Add error message
lbeder Sep 19, 2021
6c25500
Copy
lbeder Sep 19, 2021
dd8b0d9
Copy
lbeder Sep 19, 2021
14c2442
Copy
lbeder Sep 19, 2021
1b3f0cd
Refactor
lbeder Sep 19, 2021
9579ea1
add test migration to CI
sshmaxime Sep 19, 2021
24daf73
Merge pull request #81 from bancorprotocol/migration-tool-refactor
lbeder Sep 19, 2021
5c1b891
undo changes regarding governance contracts and system tokens
sshmaxime Sep 20, 2021
0ded0e4
fix undo
sshmaxime Sep 20, 2021
e6c5a29
typo
sshmaxime Sep 20, 2021
cc4bf56
remove outdated migration
sshmaxime Sep 20, 2021
e940c99
added legacy contracts + added tokengovernance to create system
sshmaxime Sep 20, 2021
90e246e
fix yarn package
sshmaxime Sep 20, 2021
44e505b
create migrations dir if it doesn't exist
sshmaxime Sep 20, 2021
52c5ede
Merge branch 'migration_tool' of github.com:bancorprotocol/contracts-…
sshmaxime Sep 20, 2021
faea684
fix yarn.lock
sshmaxime Sep 20, 2021
d39e333
add legacy BNT and vBNT tokens
sshmaxime Sep 20, 2021
448bcc3
add npm package as dependencies instead of github repo in v2 package
sshmaxime Sep 20, 2021
f9b48d1
fix dep path
sshmaxime Sep 20, 2021
ee95191
add NetworkToken & GovToken project wide
sshmaxime Sep 21, 2021
a5ed603
update tests with correct error messages
sshmaxime Sep 21, 2021
d5cfc3d
update throw error message to match with the real contracts
sshmaxime Sep 21, 2021
dac5adc
differenciate error message for BNT and TKN
sshmaxime Sep 22, 2021
84b4334
add new line
sshmaxime Sep 22, 2021
2ecb2f3
remove TestSystemToken
sshmaxime Sep 22, 2021
7fa4b10
update throw message
sshmaxime Sep 22, 2021
25b3cb8
additional fix
sshmaxime Sep 22, 2021
1244f20
add utils functions for reserveToken errors
sshmaxime Sep 23, 2021
06e74c9
typos
sshmaxime Sep 23, 2021
ad2a840
add error case for vBNT
sshmaxime Sep 24, 2021
a79ecf5
typo
sshmaxime Sep 28, 2021
183b276
Merge pull request #83 from bancorprotocol/legacy_contracts
sshmaxime Sep 28, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ jobs:

- name: Test
run: CI=1 yarn test

- name: Test Migration
run: CI=1 yarn test-migration
5 changes: 2 additions & 3 deletions packages/v2/components/Contracts.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ethers } from 'hardhat';
import { Contract as OldContract, ContractFactory, Overrides as OldOverrides } from '@ethersproject/contracts';
import { Signer } from '@ethersproject/abstract-signer';

import { Contract as OldContract, ContractFactory, Overrides as OldOverrides } from '@ethersproject/contracts';
import { ethers } from 'hardhat';
import {
BancorNetwork__factory,
BancorX__factory,
Expand Down
2 changes: 1 addition & 1 deletion packages/v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"hardhat": "2.6.4"
},
"devDependencies": {
"@bancor/token-governance": "bancorprotocol/token-governance",
"@bancor/token-governance": "^0.1.4",
"@ethersproject/hardware-wallets": "^5.4.0",
"@nomiclabs/hardhat-ethers": "^2.0.2",
"@nomiclabs/hardhat-etherscan": "^2.1.6",
Expand Down
6 changes: 6 additions & 0 deletions packages/v3/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
},
"rules": {
"max-len": ["error", 150, 2],
"camelcase": [
"error",
{
"ignoreImports": true
}
],
"indent": [
"error",
4,
Expand Down
8 changes: 8 additions & 0 deletions packages/v3/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,11 @@ scTopics
contracts/hardhat-dependency-compiler

config.json

migration/data/hardhat
migration/data/localhost
lbeder marked this conversation as resolved.
Show resolved Hide resolved
migration/data/fork*

migration/test/migration/data/hardhat
migration/test/migration/data/localhost
migration/test/migration/data/fork*
7 changes: 3 additions & 4 deletions packages/v3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ In order to use some plugins, API keys or custom network with secret config we n

```json
{
"apiKeys": {
"etherscan": ""
"keys": {
"etherscan": "XYZ"
},

"networks": {
"mainnet": {
"url": ""
"url": "https://eth-mainnet.alchemyapi.io/v2/supersecretkey"
yudilevi marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
Expand Down
62 changes: 62 additions & 0 deletions packages/v3/components/ContractBuilder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/* eslint-enable camelcase */
import { Signer } from '@ethersproject/abstract-signer';
import { ContractFactory } from '@ethersproject/contracts';
import { ethers } from 'hardhat';

type AsyncReturnType<T extends (...args: any) => any> = T extends (...args: any) => Promise<infer U>
? U
: T extends (...args: any) => infer U
? U
: any;

export type Contract<F extends ContractFactory> = AsyncReturnType<F['deploy']>;

export interface ContractBuilder<F extends ContractFactory> {
metadata: {
contractName: string;
abi: unknown;
bytecode: string;
};
deploy(...args: Parameters<F['deploy']>): Promise<Contract<F>>;
attach(address: string, signer?: Signer): Promise<Contract<F>>;
}

export type FactoryConstructor<F extends ContractFactory> = {
new (signer?: Signer): F;
abi: unknown;
bytecode: string;
};

export const deployOrAttach = <F extends ContractFactory>(
contractName: string,
// @TODO: needs to replace with correctly typed params but it doesn't
// work properly for some reason https://github.com/microsoft/TypeScript/issues/31278
FactoryConstructor: FactoryConstructor<F>,
initialSigner?: Signer
): ContractBuilder<F> => {
return {
metadata: {
contractName: contractName,
abi: FactoryConstructor.abi,
bytecode: FactoryConstructor.bytecode
},
deploy: async (...args: Parameters<F['deploy']>): Promise<Contract<F>> => {
const defaultSigner = initialSigner || (await ethers.getSigners())[0];

return new FactoryConstructor(defaultSigner).deploy(...(args || [])) as Contract<F>;
},
attach: attachOnly<F>(FactoryConstructor, initialSigner).attach
};
};

export const attachOnly = <F extends ContractFactory>(
FactoryConstructor: FactoryConstructor<F>,
initialSigner?: Signer
) => {
return {
attach: async (address: string, signer?: Signer): Promise<Contract<F>> => {
const defaultSigner = initialSigner || (await ethers.getSigners())[0];
return new FactoryConstructor(signer || defaultSigner).attach(address) as Contract<F>;
}
};
};
97 changes: 28 additions & 69 deletions packages/v3/components/Contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,89 +21,48 @@ import {
TestPoolCollection__factory,
TestReserveToken__factory,
TestSafeERC20Ex__factory,
TestSystemToken__factory,
TestTokenGovernance__factory,
TestUpgradeable__factory,
TokenHolder__factory,
TransparentUpgradeableProxy__factory
} from '../typechain';
import { deployOrAttach } from './ContractBuilder';

/* eslint-enable camelcase */
import { Signer } from '@ethersproject/abstract-signer';
import { ContractFactory } from '@ethersproject/contracts';
import { ethers } from 'hardhat';

type AsyncReturnType<T extends (...args: any) => any> = T extends (...args: any) => Promise<infer U>
? U
: T extends (...args: any) => infer U
? U
: any;

export type Contract<F extends ContractFactory> = AsyncReturnType<F['deploy']>;

export interface ContractBuilder<F extends ContractFactory> {
contractName: string;
deploy(...args: Parameters<F['deploy']>): Promise<Contract<F>>;
attach(address: string, passedSigner?: Signer): Promise<Contract<F>>;
}

const deployOrAttach = <F extends ContractFactory>(contractName: string, passedSigner?: Signer): ContractBuilder<F> => {
return {
contractName,
deploy: async (...args: Parameters<F['deploy']>): Promise<Contract<F>> => {
const defaultSigner = passedSigner || (await ethers.getSigners())[0];

return (await ethers.getContractFactory(contractName, defaultSigner)).deploy(
...(args || [])
) as Contract<F>;
},
attach: attachOnly<F>(contractName).attach
};
};

const attachOnly = <F extends ContractFactory>(contractName: string, passedSigner?: Signer) => {
return {
attach: async (address: string, signer?: Signer): Promise<Contract<F>> => {
const defaultSigner = passedSigner || (await ethers.getSigners())[0];
return ethers.getContractAt(contractName, address, signer || defaultSigner) as Contract<F>;
}
};
};

const getContracts = (signer?: Signer) => ({
connect: (signer: Signer) => getContracts(signer),

/* eslint-disable camelcase */
BancorNetwork: deployOrAttach<BancorNetwork__factory>('BancorNetwork', signer),
BancorVault: deployOrAttach<BancorVault__factory>('BancorVault', signer),
ERC20: deployOrAttach<ERC20__factory>('ERC20', signer),
PoolCollection: deployOrAttach<PoolCollection__factory>('PoolCollection', signer),
NetworkSettings: deployOrAttach<NetworkSettings__factory>('NetworkSettings', signer),
NetworkTokenPool: deployOrAttach<NetworkTokenPool__factory>('NetworkTokenPool', signer),
PendingWithdrawals: deployOrAttach<PendingWithdrawals__factory>('PendingWithdrawals', signer),
PoolToken: deployOrAttach<PoolToken__factory>('PoolToken', signer),
PoolTokenFactory: deployOrAttach<PoolTokenFactory__factory>('PoolTokenFactory', signer),
ProxyAdmin: deployOrAttach<ProxyAdmin__factory>('ProxyAdmin', signer),
TestBancorNetwork: deployOrAttach<TestBancorNetwork__factory>('TestBancorNetwork', signer),
TestERC20Token: deployOrAttach<TestERC20Token__factory>('TestERC20Token', signer),
TestERC20Burnable: deployOrAttach<TestERC20Burnable__factory>('TestERC20Burnable', signer),
TestPoolAverageRate: deployOrAttach<TestPoolAverageRate__factory>('TestPoolAverageRate', signer),
TestPoolCollection: deployOrAttach<TestPoolCollection__factory>('TestPoolCollection', signer),
TestNetworkTokenPool: deployOrAttach<TestNetworkTokenPool__factory>('TestNetworkTokenPool', signer),
TestMathEx: deployOrAttach<TestMathEx__factory>('TestMathEx', signer),
TestOwned: deployOrAttach<TestOwned__factory>('TestOwned', signer),
TestPendingWithdrawals: deployOrAttach<TestPendingWithdrawals__factory>('TestPendingWithdrawals', signer),
TestReserveToken: deployOrAttach<TestReserveToken__factory>('TestReserveToken', signer),
TestSafeERC20Ex: deployOrAttach<TestSafeERC20Ex__factory>('TestSafeERC20Ex', signer),
TestSystemToken: deployOrAttach<TestSystemToken__factory>('TestSystemToken', signer),
TestTokenGovernance: deployOrAttach<TestTokenGovernance__factory>('TestTokenGovernance', signer),
TestUpgradeable: deployOrAttach<TestUpgradeable__factory>('TestUpgradeable', signer),
TokenHolder: deployOrAttach<TokenHolder__factory>('TokenHolder', signer),
TransparentUpgradeableProxy: deployOrAttach<TransparentUpgradeableProxy__factory>(
BancorNetwork: deployOrAttach('BancorNetwork', BancorNetwork__factory, signer),
BancorVault: deployOrAttach('BancorVault', BancorVault__factory, signer),
ERC20: deployOrAttach('ERC20', ERC20__factory, signer),
PoolCollection: deployOrAttach('PoolCollection', PoolCollection__factory, signer),
NetworkSettings: deployOrAttach('NetworkSettings', NetworkSettings__factory, signer),
NetworkTokenPool: deployOrAttach('NetworkTokenPool', NetworkTokenPool__factory, signer),
PendingWithdrawals: deployOrAttach('PendingWithdrawals', PendingWithdrawals__factory, signer),
PoolToken: deployOrAttach('PoolToken', PoolToken__factory, signer),
PoolTokenFactory: deployOrAttach('PoolTokenFactory', PoolTokenFactory__factory, signer),
ProxyAdmin: deployOrAttach('ProxyAdmin', ProxyAdmin__factory, signer),
TestBancorNetwork: deployOrAttach('TestBancorNetwork', TestBancorNetwork__factory, signer),
TestERC20Token: deployOrAttach('TestERC20Token', TestERC20Token__factory, signer),
TestERC20Burnable: deployOrAttach('TestERC20Burnable', TestERC20Burnable__factory, signer),
TestPoolAverageRate: deployOrAttach('TestPoolAverageRate', TestPoolAverageRate__factory, signer),
TestPoolCollection: deployOrAttach('TestPoolCollection', TestPoolCollection__factory, signer),
TestNetworkTokenPool: deployOrAttach('TestNetworkTokenPool', TestNetworkTokenPool__factory, signer),
TestMathEx: deployOrAttach('TestMathEx', TestMathEx__factory, signer),
TestOwned: deployOrAttach('TestOwned', TestOwned__factory, signer),
TestPendingWithdrawals: deployOrAttach('TestPendingWithdrawals', TestPendingWithdrawals__factory, signer),
TestReserveToken: deployOrAttach('TestReserveToken', TestReserveToken__factory, signer),
TestSafeERC20Ex: deployOrAttach('TestSafeERC20Ex', TestSafeERC20Ex__factory, signer),
TestUpgradeable: deployOrAttach('TestUpgradeable', TestUpgradeable__factory, signer),
TokenHolder: deployOrAttach('TokenHolder', TokenHolder__factory, signer),
TransparentUpgradeableProxy: deployOrAttach(
'TransparentUpgradeableProxy',
TransparentUpgradeableProxy__factory,
signer
)
/* eslint-enable camelcase */
});

export type ContractsType = ReturnType<typeof getContracts>;

export default getContracts();
26 changes: 26 additions & 0 deletions packages/v3/components/LegacyContracts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* eslint-disable camelcase */
import { deployOrAttach } from './ContractBuilder';
import {
TokenGovernance__factory,
SmartToken__factory as NetworkToken__factory,
SmartToken as NetworkToken,
DSToken__factory as GovToken__factory,
DSToken as GovToken
} from '@bancor/token-governance';
import { Signer } from '@ethersproject/abstract-signer';

export { NetworkToken, GovToken };

/* eslint-enable camelcase */

const getContracts = (signer?: Signer) => ({
connect: (signer: Signer) => getContracts(signer),

TokenGovernance: deployOrAttach('TokenGovernance', TokenGovernance__factory, signer),
NetworkToken: deployOrAttach('BNTToken', NetworkToken__factory, signer),
GovToken: deployOrAttach('vBNTToken', GovToken__factory, signer)
});

export type ContractsType = ReturnType<typeof getContracts>;

export default getContracts();
2 changes: 1 addition & 1 deletion packages/v3/contracts/helpers/TestBancorNetwork.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { EnumerableSetUpgradeable } from "@openzeppelin/contracts-upgradeable/ut
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";

import { ITokenGovernance } from "@bancor/token-governance/0.7.6/contracts/TokenGovernance.sol";
import { ITokenGovernance } from "@bancor/token-governance/contracts/ITokenGovernance.sol";

import { Time } from "../utility/Time.sol";

Expand Down
37 changes: 0 additions & 37 deletions packages/v3/contracts/helpers/TestSystemToken.sol

This file was deleted.

9 changes: 0 additions & 9 deletions packages/v3/contracts/helpers/TestTokenGovernance.sol

This file was deleted.

2 changes: 1 addition & 1 deletion packages/v3/contracts/network/BancorNetwork.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { IERC20Permit } from "@openzeppelin/contracts/drafts/IERC20Permit.sol";
import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
import { EnumerableSetUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/EnumerableSetUpgradeable.sol";

import { ITokenGovernance } from "@bancor/token-governance/0.7.6/contracts/TokenGovernance.sol";
import { ITokenGovernance } from "@bancor/token-governance/contracts/ITokenGovernance.sol";

import { ITokenHolder } from "../utility/interfaces/ITokenHolder.sol";
import { Upgradeable } from "../utility/Upgradeable.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.7.6;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import { ITokenGovernance } from "@bancor/token-governance/0.7.6/contracts/TokenGovernance.sol";
import { ITokenGovernance } from "@bancor/token-governance/contracts/ITokenGovernance.sol";

import { IUpgradeable } from "../../utility/interfaces/IUpgradeable.sol";
import { ITokenHolder } from "../../utility/interfaces/ITokenHolder.sol";
Expand Down
2 changes: 1 addition & 1 deletion packages/v3/contracts/pools/NetworkTokenPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Math } from "@openzeppelin/contracts/math/Math.sol";
import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";

import { ITokenGovernance } from "@bancor/token-governance/0.7.6/contracts/TokenGovernance.sol";
import { ITokenGovernance } from "@bancor/token-governance/contracts/ITokenGovernance.sol";

import { IReserveToken } from "../token/interfaces/IReserveToken.sol";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma abicoder v2;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import { ITokenGovernance } from "@bancor/token-governance/0.7.6/contracts/TokenGovernance.sol";
import { ITokenGovernance } from "@bancor/token-governance/contracts/ITokenGovernance.sol";

import { IPoolToken } from "./IPoolToken.sol";
import { IPoolCollection } from "./IPoolCollection.sol";
Expand Down
2 changes: 1 addition & 1 deletion packages/v3/contracts/token/interfaces/IReserveToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pragma solidity 0.7.6;
* @dev This contract is used to represent reserve tokens, which are tokens that can either be regular ERC20 tokens or
* native ETH (represented by the NATIVE_TOKEN_ADDRESS address)
*
* Please note that this interface is intentionally doesn't inherit from IERC20, so that it'd be possible to effectively
* Please note that this interface intentionally doesn't inherit from IERC20, so that it'd be possible to effectively
* override its balanceOf() function in the ReserveToken library
*/
interface IReserveToken {
Expand Down
Loading