-
Notifications
You must be signed in to change notification settings - Fork 91
chore(smart-contracts): publish to tenderly #1048
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
Changes from 9 commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
c108ad2
chore(smart-contracts): publish to tenderly
alexandre-abrioux 89bb0ba
WIP
alexandre-abrioux 53501d1
Merge branch 'master' into tenderly-contracts
alexandre-abrioux bd35879
yarn lockfile
alexandre-abrioux 0d35b33
fix axios version
alexandre-abrioux b06bd1e
finish & test
alexandre-abrioux 9fcffbc
wording
alexandre-abrioux 222c30f
undo
alexandre-abrioux 5fa415e
rename file
alexandre-abrioux dc410f6
WIP
alexandre-abrioux ed3b672
WIP
alexandre-abrioux 924a70e
fixes
alexandre-abrioux 4aee325
Merge branch 'master' into networks
alexandre-abrioux bae4830
fix ERC20 order
alexandre-abrioux e7ecfb9
fix indentation
alexandre-abrioux 8771389
fix tests
alexandre-abrioux d48802d
rollback changes
alexandre-abrioux 753fe99
fix tests
alexandre-abrioux 5bc4f96
fix tests
alexandre-abrioux 5363d3c
fix tests
alexandre-abrioux 256b6df
fix tests
alexandre-abrioux 21b92fc
rollback test
alexandre-abrioux 7bd75c7
fix tests
alexandre-abrioux b2ed93b
Merge branch 'master' into networks
alexandre-abrioux d6ae451
remove aurora from evm
alexandre-abrioux c7b3112
remove unused export
alexandre-abrioux e52eb10
fix missing export
alexandre-abrioux a446daf
change chaindefinition type name
alexandre-abrioux f454936
edit README
alexandre-abrioux 05ab7d5
refactor chain types to classes
alexandre-abrioux ddf73ac
fix test
alexandre-abrioux 94cf0e8
remove unusued utils
alexandre-abrioux c3d01ad
fix some more types
alexandre-abrioux ead5d9b
fix some more types
alexandre-abrioux a9a3029
fix test types
alexandre-abrioux 737aee6
fix test
alexandre-abrioux f44f683
fix near typing
alexandre-abrioux 87c5cd0
fix currencyManager
alexandre-abrioux 3d7c730
fix aggregators type
alexandre-abrioux 2b1fd4f
fix aggregators type
alexandre-abrioux 9baa2f8
fix chainlink test
alexandre-abrioux 100f709
rollback currency manager change
alexandre-abrioux 1c240b7
rollback addagregator change
alexandre-abrioux b5957a1
Merge branch 'networks' into tenderly-contracts
alexandre-abrioux 8e4d4cd
use chain configuration
alexandre-abrioux 729096e
fix ArtifactDeploymentInfo
alexandre-abrioux ad88345
Merge branch 'networks' into tenderly-contracts
alexandre-abrioux 9e98eb8
rollback import line change
alexandre-abrioux cc4aa87
add testnet chain configuration
alexandre-abrioux ec78933
remove comment
alexandre-abrioux 97b3438
fix type for ERC20Currency
alexandre-abrioux 8f56b91
Merge branch 'master' into networks
alexandre-abrioux 3452fd1
add README
alexandre-abrioux 71f0809
Merge branch 'master' into networks
alexandre-abrioux 9c014a9
Merge remote-tracking branch 'origin/master' into networks
alexandre-abrioux 8d815f0
fix build
alexandre-abrioux 51030c1
fix missing type
alexandre-abrioux 0190ec2
Merge branch 'master' into networks
alexandre-abrioux 0b99099
fix type errors
alexandre-abrioux 66c75b8
Merge branch 'networks' into tenderly-contracts
alexandre-abrioux a551b40
Merge remote-tracking branch 'origin/master' into tenderly-contracts
alexandre-abrioux 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
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,51 @@ | ||
| import { HardhatRuntimeEnvironmentExtended } from './types'; | ||
| import axios from 'axios'; | ||
| import * as artifacts from '../src/lib/artifacts'; | ||
| import { getChainConfig } from './utils/chains'; | ||
| import { ContractArtifact } from '../src/lib'; | ||
| import { Contract } from 'ethers'; | ||
| import * as console from 'console'; | ||
|
|
||
| const getTenderlyAxiosInstance = (hre: HardhatRuntimeEnvironmentExtended) => { | ||
| return axios.create({ | ||
| baseURL: 'https://api.tenderly.co', | ||
| headers: { | ||
| 'X-Access-Key': hre.config.tenderly.accessKey, | ||
| }, | ||
| }); | ||
| }; | ||
|
|
||
| const capitalizeFirstLetter = (string: string) => string.charAt(0).toUpperCase() + string.slice(1); | ||
|
|
||
| export const tenderlyImportAll = async (hre: HardhatRuntimeEnvironmentExtended): Promise<void> => { | ||
| const { username, project } = hre.config.tenderly; | ||
| try { | ||
| const contracts: Array<{ name: string; address: string; networkId: number }> = []; | ||
| for (const artifactName in artifacts) { | ||
| const artifact = (artifacts as any)[artifactName] as ContractArtifact<Contract>; | ||
| const deployments = artifact.getAllAddressesFromAllNetworks(); | ||
| for (const deployment of deployments) { | ||
| const { networkName } = deployment; | ||
| if (['private', 'rinkeby', 'bsctest', 'alfajores'].includes(networkName)) continue; | ||
| const chainConfig = await getChainConfig(networkName); | ||
| if (!chainConfig) continue; | ||
| const sanitizedArtifactName = artifactName.replace(/Artifact/i, ''); | ||
| contracts.push({ | ||
| name: `${capitalizeFirstLetter(sanitizedArtifactName)}-${deployment.version}`, | ||
| address: deployment.address, | ||
| networkId: chainConfig.chainId, | ||
| }); | ||
| } | ||
| } | ||
| const axiosInstance = getTenderlyAxiosInstance(hre); | ||
| await axiosInstance.post(`/api/v2/accounts/${username}/projects/${project}/contracts`, { | ||
| contracts: contracts.map((contract) => ({ | ||
| address: contract.address, | ||
| display_name: contract.name, | ||
| network_id: contract.networkId.toString(), | ||
| })), | ||
| }); | ||
| } catch (err) { | ||
| console.error('Error while adding contract(s) to Tenderly', err.response?.data || err); | ||
| } | ||
| }; |
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,23 @@ | ||
| import axios from 'axios'; | ||
|
|
||
| type ChainConfig = { | ||
| name: string; | ||
| chainId: number; | ||
| rpcUrls: string[]; | ||
| }; | ||
|
|
||
| const cachedChainConfigs: Record<string, ChainConfig> = {}; | ||
|
|
||
| export const getChainConfig = async (chainName: string) => { | ||
| try { | ||
| if (cachedChainConfigs[chainName]) return cachedChainConfigs[chainName]; | ||
| const { data } = await axios.get<ChainConfig>( | ||
| `https://api.request.network/currency/chains/${chainName}`, | ||
| ); | ||
| cachedChainConfigs[chainName] = data; | ||
| return data; | ||
| } catch (e) { | ||
| console.warn(e.message); | ||
| return null; | ||
| } | ||
| }; | ||
2 changes: 1 addition & 1 deletion
2
.../smart-contracts/scripts-create2/utils.ts → ...-contracts/scripts-create2/utils/index.ts
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.