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