-
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
661c32e
commit 86813f3
Showing
14 changed files
with
246 additions
and
73 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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# accounts | ||
ACCOUNTS_PRIVATE_KEY_1="" | ||
ACCOUNTS_PRIVATE_KEY_2="" | ||
ACCOUNTS_PRIVATE_KEY_1="" | ||
|
||
|
||
# networks | ||
MUMBAI_API_KEY="" | ||
PUBLIC_NETWORK_43113_HTTP_RPC="" | ||
ETHERSCAN_API_KEY="" | ||
AVALANCHE_FUJI_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 |
---|---|---|
@@ -1,3 +1,52 @@ | ||
# 0xdevhub - Crosschain NFT contracts | ||
|
||
[![Run Tests](https://github.com/0xdevhub/crosschain-nft-contracts/actions/workflows/tests.yml/badge.svg)](https://github.com/0xdevhub/crosschain-nft-contracts/actions/workflows/tests.yml) | ||
|
||
## Networks | ||
|
||
- Avalanche Fuji (43113) | ||
- Arbitrum Rinkeby (soon) | ||
|
||
## Contracts | ||
|
||
- Avalanche Fuji: (soon) | ||
- Arbitrum Rinkeby: (soon) | ||
|
||
#### Deploying contracts | ||
|
||
not available | ||
|
||
#### Verifing contracts | ||
|
||
```shell | ||
pnpm verify --contract contracts/[ContractName].sol:[Contract] --network [networkid] [contractAddress] ["ARGUMENTS"] | ||
``` | ||
|
||
#### Adding new adapter | ||
|
||
ToDo | ||
|
||
## Getting Started | ||
|
||
```shell | ||
pnpm compile | ||
pnpm typechain | ||
pnpm node | ||
pnpm deploy:localhost | ||
pnpm deploy:mumbai | ||
``` | ||
|
||
## Available scrips by `dlx hardhat` | ||
|
||
```shell | ||
dlx hardhat help | ||
REPORT_GAS=true dlx hardhat test | ||
``` | ||
|
||
## Testing | ||
|
||
```bash | ||
pnpm test | ||
pnpm test:watch | ||
pnpm test:coverage | ||
``` |
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 @@ | ||
export const evmAccounts = [ | ||
String(process.env.ACCOUNTS_PRIVATE_KEY_1) // owner | ||
] |
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,32 @@ | ||
import { evmAccounts } from './accounts' | ||
import { Chain } from './types' | ||
|
||
export const avalancheFuji: Chain = { | ||
id: 43_113, | ||
name: 'Avalanche Fuji', | ||
network: 'avalanche-fuji', | ||
nativeCurrency: { | ||
decimals: 18, | ||
name: 'Avalanche Fuji', | ||
symbol: 'AVAX' | ||
}, | ||
accounts: evmAccounts, | ||
rpcUrls: { | ||
protocol: { | ||
http: [process.env.PUBLIC_NETWORK_43113_HTTP_RPC!] | ||
}, | ||
default: { http: ['https://api.avax-test.network/ext/bc/C/rpc'] }, | ||
public: { http: ['https://api.avax-test.network/ext/bc/C/rpc'] } | ||
}, | ||
blockExplorers: { | ||
etherscan: { name: 'SnowTrace', url: 'https://testnet.snowtrace.io' }, | ||
default: { name: 'SnowTrace', url: 'https://testnet.snowtrace.io' } | ||
}, | ||
contracts: { | ||
multicall3: { | ||
address: '0xca11bde05977b3631167028862be2a173976ca11', | ||
blockCreated: 7096959 | ||
} | ||
}, | ||
testnet: 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,15 @@ | ||
import { reduce } from 'lodash' | ||
import { avalancheFuji } from './chains' | ||
import { Chain } from './types' | ||
|
||
export const allowedChains = [avalancheFuji] | ||
|
||
export const allowedChainsConfig = reduce( | ||
allowedChains, | ||
(acc, chain: Chain) => { | ||
acc[chain.id] = chain | ||
|
||
return acc | ||
}, | ||
{} as { [key: number]: Chain } | ||
) |
This file was deleted.
Oops, something went wrong.
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,40 @@ | ||
export interface NativeCurrency { | ||
decimals: number | ||
name: string | ||
symbol: string | ||
} | ||
|
||
export interface RpcUrls { | ||
http: string[] | ||
} | ||
|
||
export interface BlockExplorer { | ||
name: string | ||
url: string | ||
} | ||
|
||
export interface Contracts { | ||
multicall3: { | ||
address: string | ||
blockCreated: number | ||
} | ||
} | ||
|
||
export interface Chain { | ||
id: number | ||
name: string | ||
network: string | ||
accounts: string[] | ||
nativeCurrency: NativeCurrency | ||
rpcUrls: { | ||
[key: string]: RpcUrls | ||
default: RpcUrls | ||
public: RpcUrls | ||
} | ||
blockExplorers: { | ||
etherscan: BlockExplorer | ||
default: BlockExplorer | ||
} | ||
contracts: Contracts | ||
testnet: boolean | ||
} |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,49 +1,23 @@ | ||
import { | ||
deployContract, | ||
getContractAddress, | ||
getContractAt, | ||
getNetwork, | ||
getSigners | ||
} from './utils' | ||
import { Spinner } from './spinner' | ||
import cliSpinner from 'cli-spinners' | ||
|
||
import { DEVELOPER_ROLE, DEVELOPER_ROLE_DELAY } from './constants' | ||
const spinner: Spinner = new Spinner(cliSpinner.triangle) | ||
|
||
async function main() { | ||
const { chainId } = await getNetwork() | ||
console.log('chainId ' + chainId) | ||
const deploy = async () => { | ||
// deploy hub contract | ||
console.log(`ℹ️ Deploying...`) | ||
|
||
const [owner, developer] = await getSigners() | ||
console.log('owner:' + owner.address) | ||
|
||
// deploy access management contract | ||
const accessManagement = await deployContract( | ||
'AccessManagement', | ||
owner.address | ||
) | ||
const accessManagementAddress = await getContractAddress(accessManagement) | ||
console.log('accessManagementAddress:' + accessManagementAddress) | ||
|
||
// grant role to developer | ||
const accessManagementContract = await getContractAt( | ||
'AccessManagement', | ||
accessManagementAddress | ||
) | ||
|
||
await accessManagementContract.grantRole( | ||
DEVELOPER_ROLE, | ||
developer.address, | ||
DEVELOPER_ROLE_DELAY | ||
) | ||
|
||
console.log( | ||
'developer role granted: ', | ||
developer.address, | ||
DEVELOPER_ROLE, | ||
DEVELOPER_ROLE_DELAY | ||
) | ||
console.log(`✅ deployed`) | ||
} | ||
|
||
main().catch((error) => { | ||
console.error(error) | ||
process.exitCode = 1 | ||
}) | ||
;(async () => { | ||
try { | ||
spinner.start() | ||
await deploy() | ||
spinner.stop() | ||
} catch (error) { | ||
console.error(error) | ||
process.exitCode = 1 | ||
spinner.stop() | ||
} | ||
})() |
Oops, something went wrong.