-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
929f3f8
commit 5d6eff3
Showing
55 changed files
with
13,491 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,21 @@ | ||
# Config for multi-network deployment | ||
HARDHAT_NETWORK= | ||
VERIFY_API_KEY= | ||
|
||
# Config for Tenderly - testing environment | ||
TENDERLY_TESTNET_PROVIDER_URL= | ||
TENDERLY_TESTNET_ID= | ||
TENDERLY_IS_FORK= | ||
TENDERLY_FORK_ID= | ||
TENDERLY_PROJECT= | ||
TENDERLY_USERNAME= | ||
TENDERLY_ACCESS_KEY= | ||
TENDERLY_TEST_PROJECT= | ||
TENDERLY_TEMP_PROJECT= | ||
|
||
# What network to fork from, default to 'mainnet' | ||
TENDERLY_NETWORK_NAME= | ||
SENTRY_DSN= | ||
DEV_ADDRESSES= | ||
# Sei RPC api key | ||
SEI_RPC_API_KEY= |
This file contains 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,59 @@ | ||
{ | ||
"extends": ["standard", "prettier", "plugin:@typescript-eslint/recommended"], | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": ["@typescript-eslint", "mocha"], | ||
"env": { | ||
"mocha": true | ||
}, | ||
"rules": { | ||
"max-len": ["error", 150, 2], | ||
"camelcase": [ | ||
"error", | ||
{ | ||
"ignoreImports": true | ||
} | ||
], | ||
"indent": [ | ||
"error", | ||
4, | ||
{ | ||
"SwitchCase": 1 | ||
} | ||
], | ||
"semi": ["error", "always"], | ||
"no-plusplus": "off", | ||
"no-await-in-loop": "off", | ||
"no-restricted-syntax": "off", | ||
"no-continue": "off", | ||
"arrow-body-style": "off", | ||
"no-loop-func": "off", | ||
"no-unused-expressions": "off", | ||
"mocha/no-exclusive-tests": "error", | ||
"no-console": "error", | ||
"@typescript-eslint/no-floating-promises": "error", | ||
"@typescript-eslint/prefer-nullish-coalescing": "error", | ||
"@typescript-eslint/explicit-module-boundary-types": "off", | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"@typescript-eslint/no-non-null-assertion": "off" | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"parserOptions": { | ||
"project": "./tsconfig.json" | ||
} | ||
} | ||
], | ||
"globals": { | ||
"assert": true, | ||
"expect": true, | ||
"artifacts": true, | ||
"contract": true, | ||
"web3": true | ||
}, | ||
"settings": { | ||
"react": { | ||
"version": "999.999.999" | ||
} | ||
} | ||
} |
This file contains 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,53 @@ | ||
name: CI | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
|
||
runs-on: macos-latest | ||
timeout-minutes: 600 | ||
|
||
steps: | ||
- name: Cancel previous runs | ||
uses: styfle/[email protected] | ||
with: | ||
all_but_latest: true | ||
access_token: ${{ github.token }} | ||
|
||
- name: Check out the repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Set up pnpm | ||
uses: pnpm/action-setup@v4 | ||
with: | ||
version: 9 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
cache: 'pnpm' | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Lint | ||
run: pnpm lint | ||
|
||
- name: Test | ||
run: pnpm test | ||
|
This file contains 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,24 @@ | ||
.DS_Store | ||
.vscode/ | ||
*/**/.DS_Store | ||
|
||
node_modules | ||
.env | ||
|
||
dist | ||
out | ||
cache | ||
cache_forge | ||
artifacts | ||
typechain-types | ||
|
||
contracts/hardhat-dependency-compiler | ||
|
||
deployments/**/solcInputs/* | ||
deployments/**/types/* | ||
deployments/hardhat/* | ||
deployments/tenderly/* | ||
deployments/tenderly-testnet/* | ||
|
||
fork-*.zip | ||
testnet-*.zip |
This file contains 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,3 @@ | ||
[submodule "lib/forge-std"] | ||
path = lib/forge-std | ||
url = https://github.com/foundry-rs/forge-std |
This file contains 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 @@ | ||
side-effects-cache=false |
This file contains 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,34 @@ | ||
{ | ||
"overrides": [ | ||
{ | ||
"files": "*.sol", | ||
"options": { | ||
"singleQuote": false, | ||
"explicitTypes": "always" | ||
} | ||
}, | ||
{ | ||
"files": "*.yml", | ||
"options": { | ||
"tabWidth": 2 | ||
} | ||
}, | ||
{ | ||
"files": "*.json", | ||
"options": { | ||
"tabWidth": 2 | ||
} | ||
} | ||
], | ||
"plugins": ["prettier-plugin-solidity"], | ||
"printWidth": 120, | ||
"tabWidth": 4, | ||
"useTabs": false, | ||
"semi": true, | ||
"singleQuote": true, | ||
"trailingComma": "none", | ||
"arrowParens": "always", | ||
"bracketSpacing": true, | ||
"importOrderSortSpecifiers": true, | ||
"importOrderCaseInsensitive": true | ||
} |
This file contains 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,14 @@ | ||
{ | ||
"extends": "solhint:recommended", | ||
"rules": { | ||
"avoid-throw": "off", | ||
"avoid-suicide": "error", | ||
"avoid-sha3": "warn", | ||
"not-rely-on-time": "off", | ||
"no-empty-blocks": "off", | ||
"mark-callable-contracts": "off", | ||
"immutable-vars-naming": "off", | ||
"func-visibility": ["error", { "ignoreConstructors": true }], | ||
"compiler-version": ["error", "0.8.28"] | ||
} | ||
} |
This file contains 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 @@ | ||
(c) Bprotocol Foundation, 2023 | ||
|
||
Except as otherwise provided in the header of a specific source code | ||
file in this repository: (a) all intellectual property (including all | ||
source code, designs and protocols) contained in this repository has been | ||
published for informational purposes only; (b) no license, right of | ||
reproduction or distribution or other right with respect thereto is | ||
granted or implied; and (c) all moral, intellectual property and other | ||
rights are hereby reserved by the copyright holder. | ||
|
||
THE SOFTWARE AND INTELLECTUAL PROPERTY INCLUDED IN THIS REPOSITORY | ||
IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS," AND ANY EXPRESS | ||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE OR | ||
INTELLECTUAL PROPERTY (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT | ||
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
BUSINESS INTERRUPTION), HOWEVER CAUSED OR CLAIMED (WHETHER IN CONTRACT, | ||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)), EVEN IF | ||
SUCH DAMAGES WERE REASONABLY FORESEEABLE OR THE COPYRIGHT HOLDERS WERE | ||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains 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,64 @@ | ||
import { ContractFactory, Signer } from 'ethers'; | ||
import { ethers } from 'hardhat'; | ||
import { ABI } from 'hardhat-deploy/types'; | ||
|
||
export 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: ABI; | ||
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, | ||
FactoryConstructor: FactoryConstructor<F>, | ||
initialSigner?: Signer | ||
): ContractBuilder<F> => { | ||
return { | ||
metadata: { | ||
contractName, | ||
abi: FactoryConstructor.abi as 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 Promise<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>; | ||
} | ||
}; | ||
}; | ||
|
||
export interface ArtifactData { | ||
abi: ABI; | ||
bytecode: string; | ||
} |
This file contains 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,21 @@ | ||
/* eslint-disable camelcase */ | ||
import { CarbonVortexBridge__factory, TransparentUpgradeableProxyImmutable__factory } from '../typechain-types'; | ||
import { deployOrAttach } from './ContractBuilder'; | ||
import { Signer } from 'ethers'; | ||
|
||
export * from '../typechain-types'; | ||
|
||
const getContracts = (signer?: Signer) => ({ | ||
connect: (signer: Signer) => getContracts(signer), | ||
|
||
CarbonVortexBridge: deployOrAttach('CarbonVortexBridge', CarbonVortexBridge__factory, signer), | ||
TransparentUpgradeableProxyImmutable: deployOrAttach( | ||
'TransparentUpgradeableProxyImmutable', | ||
TransparentUpgradeableProxyImmutable__factory, | ||
signer | ||
) | ||
}); | ||
|
||
export type ContractsType = ReturnType<typeof getContracts>; | ||
|
||
export default getContracts(); |
Oops, something went wrong.