Skip to content

Commit

Permalink
Merge pull request Uniswap#61 from publu/feat/royalaid/base
Browse files Browse the repository at this point in the history
All your BASE
  • Loading branch information
publu authored Aug 23, 2023
2 parents 7358714 + 8213522 commit 4c44109
Show file tree
Hide file tree
Showing 8 changed files with 274 additions and 25 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@qidao/sdk",
"license": "MIT",
"version": "5.2.9",
"version": "5.2.13",
"description": "🛠 An SDK for building applications on top of QiDao Protocol.",
"main": "./dist/index.js",
"umd:main": "dist/index.umd.js",
Expand Down
97 changes: 97 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/bin/bash

# Check if jq is installed
if ! command -v jq &> /dev/null; then
echo "The 'jq' command is not found. Please install it to proceed."
exit 1
fi

# Check if gh is installed
if ! command -v gh &> /dev/null; then
echo "The 'gh' command is not found. Please install it to proceed."
exit 1
fi

# Read the version from package.json
VERSION=$(jq -r '.version' package.json)

if [ -z "$VERSION" ]; then
echo "Version not found in package.json. Make sure the version is defined."
exit 1
fi

# Check if the version is already published on GitHub
if gh release list | grep "v${VERSION}" &> /dev/null; then
echo "Version v${VERSION} is already published on GitHub."
read -p "Please bump the version in package.json, commit the change, and run the script again. Do you want to continue with the current version anyway? (y/n): " continue_with_version
if [[ ! $continue_with_version =~ ^[Yy]$ ]]; then
echo "User chose not to proceed. Exiting."
exit 1
fi
fi

# Fetch the latest tags from the remote repository
git fetch --tags

# Check if the tag exists on the remote repository
if git ls-remote --tags origin | grep "v${VERSION}" &> /dev/null; then
echo "Tag v${VERSION} already exists on origin."
else
# Get the short hash of the latest commit
SHORT_HASH=$(git rev-parse --short HEAD)

# Get the latest commit message with newline separators for clarity
COMMIT_MSG=$(git log -1 --pretty=%B)

# Prompt the user to create the tag, including the short hash and commit message
echo -e "Tag v${VERSION} does not exist on origin. Latest commit:"
echo -e "$SHORT_HASH - $COMMIT_MSG"
read -p "Do you wish to create the tag? (y/n): " create_tag

if [[ $create_tag =~ ^[Yy]$ ]]; then
git tag "v${VERSION}"
git push origin "v${VERSION}"
echo "Tag v${VERSION} created and pushed to origin."
else
echo "User chose not to create the tag. Exiting."
exit 1
fi
fi

# Run the yarn pack command
yarn pack

# Check if the yarn pack command was successful
if [ $? -ne 0 ]; then
echo "yarn pack command failed. Exiting."
exit 1
fi

# Create the GitHub release with custom parameters
gh release create "v${VERSION}" "./qidao-sdk-v${VERSION}.tgz" --title "v${VERSION}" --notes "" --prerelease

# Check if the gh release command was successful
if [ $? -ne 0 ]; then
echo "gh release command failed. Exiting."
exit 1
fi

echo "Release created successfully!"

# Get the remote URL for 'origin'
REMOTE_URL=$(git remote get-url origin)

# Extract the GitHub username and repository name from the remote URL
USERNAME=$(echo "$REMOTE_URL" | sed -n 's/.*github.com[/:]\([^.]*\)\/\([^.]*\).git/\1/p')
REPO_NAME=$(echo "$REMOTE_URL" | sed -n 's/.*github.com[/:]\([^.]*\)\/\([^.]*\).git/\2/p')

# Define the tag name and asset name
TAG_NAME="v${VERSION}"
ASSET_NAME="qidao-sdk-v${VERSION}.tgz"

# Construct the full URL for the package on GitHub
PACKAGE_URL="https://github.com/${USERNAME}/${REPO_NAME}/releases/download/${TAG_NAME}/${ASSET_NAME}"

# Print the URL for including in package.json
echo "To include the package in a package.json file, use the following URL:"
echo "$PACKAGE_URL"
18 changes: 18 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export const ARBI_GAINS_ZAPPER = '0xeA97a391aD06a1F81C565CE29Fd4AD09c6FBE1B9'

export const MAINNET_ZAPPER = '0x5AA5079A8037f9D050D838AEFCe10bA7B8b8b001'

export const BASE_THREE_STEP_ZAPPER = '0x70dD6dEf31E7285EcA5d2341FD9136A786c29422'

export enum ChainId {
MAINNET = 1,
GÖRLI = 5,
Expand Down Expand Up @@ -52,6 +54,7 @@ export enum ChainId {
CANTO = 7700,
DOGECHAIN = 2000,
ZKEVM = 1101,
BASE = 8453,
}

export enum TradeType {
Expand Down Expand Up @@ -125,22 +128,33 @@ export const MULTICALL_NETWORKS: { [chainId in ChainId]: string } = {
[ChainId.CANTO]: '0xcA11bde05977b3631167028862bE2a173976CA11',
[ChainId.DOGECHAIN]: '0xa51317d3365e8Ac0758bf3962A63892F612b942E',
[ChainId.ZKEVM]: '0xcA11bde05977b3631167028862bE2a173976CA11',
[ChainId.BASE]: '0xcA11bde05977b3631167028862bE2a173976CA11',
}

export const TOKEN_DESCRIPTIONS = tokenDescriptions

//Collateral Addresses
export const WFTM_ADDRESS = '0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83'
export const STETH_ADDRESS = '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84'

export const METIS_WBTC_ADDRESS = '0xa5B55ab1dAF0F8e1EFc0eB1931a957fd89B918f4'

export const AAVE_ADDRESS = '0xD6DF932A45C0f255f85145f286eA0b292B21C90B'

export const ETH_CRV_ADDRESS = '0xD533a949740bb3306d119CC777fa900bA034cd52'

export const ARBI_ARB_ADDRESS = '0x912CE59144191C1204E64559FE8253a0e49E6548'

export const ETH_CBETH_ADDRESS = '0xBe9895146f7AF43049ca1c1AE358B0541Ea49704'
export const ETH_STETH_ADDRESS = '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84'
export const ETH_LDO_ADDRESS = '0x5A98FcBEA516Cf06857215779Fd812CA3beF1B32'

export const ZKEVM_WETH_ADDRESS = '0x4F9A0e7FD2Bf6067db6994CF12E4495Df938E6e9'
export const ZKEVM_WMATIC_ADDRESS = '0xa2036f0538221a77A3937F1379699f44945018d0'

export const BASE_WETH_ADDRESS = '0x4200000000000000000000000000000000000006'
export const BASE_CBETH_ADDRESS = '0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22'

//CAM Vaults
export const CAMWMATIC_VAULT_ADDRESS = '0x88d84a85A87ED12B8f098e8953B322fF789fCD1a'
export const CAMWETH_VAULT_ADDRESS = '0x11A33631a5B5349AF3F165d2B7901A4d67e561ad'
Expand Down Expand Up @@ -189,3 +203,7 @@ export const ETH_STETH_VAULT_ADDRESS = '0x5773e8953cF60F495eB3c2Db45DD753b5c4b74
export const ETH_LDO_VAULT_ADDRESS = '0x954ac12c339c60eafbb32213b15af3f7c7a0dec2'
export const ZKEVM_WETH_VAULT_ADDRESS = '0xdb1103a8F51823f5a2439c52C06921CDF929F6A7'
export const ZKEVM_WMATIC_VAULT_ADDRESS = '0x8AB01c5Ee3422099156ab151eecB83c095626599'

//BASE Vaults
export const BASE_WETH_VAULT_ADDRESS = '0x8D6CeBD76f18E1558D4DB88138e2DeFB3909fAD6'
export const BASE_CBETH_VAULT_ADDRESS = '0x7333fd58d8D73a8e5FC1a16C8037ADa4f580FA2B'
1 change: 1 addition & 0 deletions src/entities/currency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export class Currency {
[ChainId.CANTO]: Currency.CANTO,
[ChainId.DOGECHAIN]: Currency.WWDOGE,
[ChainId.ZKEVM]: Currency.ETHER,
[ChainId.BASE]: Currency.ETHER,
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/entities/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,5 @@ export const WNATIVE = {
'Wrapped Wrapped Doge'
),
[ChainId.ZKEVM]: new Token(ChainId.ZKEVM, '0x4F9A0e7FD2Bf6067db6994CF12E4495Df938E6e9', 18, 'WETH', 'Wrapped Ether'),
[ChainId.BASE]: new Token(ChainId.BASE, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'),
}
1 change: 1 addition & 0 deletions src/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,5 @@ export const MAI: ChainTokenMap = {
[ChainId.KAVA]: makeMaiToken(ChainId.KAVA, '0xb84Df10966a5D7e1ab46D9276F55d57bD336AFC7'),
[ChainId.DOGECHAIN]: makeMaiToken(ChainId.DOGECHAIN, '0xb84Df10966a5D7e1ab46D9276F55d57bD336AFC7'),
[ChainId.ZKEVM]: makeMaiToken(ChainId.ZKEVM, '0x27a4BF80C2d63E42437258533dac7eAFF9881bdB'),
[ChainId.BASE]: makeMaiToken(ChainId.BASE, '0xbf1aeA8670D2528E08334083616dD9C5F3B087aE'),
}
Loading

0 comments on commit 4c44109

Please sign in to comment.