Skip to content

Commit

Permalink
refactor: update stacks contract addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
bolasblack committed Aug 25, 2024
1 parent 02b7ba5 commit d7b6a12
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 30 deletions.
5 changes: 3 additions & 2 deletions scripts/generateClarityTranscoders.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { generateContracts } from "clarity-codegen/lib/generate"
import * as path from "node:path"
import { STACKS_CONTRACT_DEPLOYER_MAINNET, STACKS_MAINNET } from "../src/config"
import { STACKS_MAINNET } from "../src/config"
import { xlinkContractsDeployerMainnet } from "../src/stacksUtils/stxContractAddresses"
;(async function main(): Promise<void> {
await generateContracts(
STACKS_MAINNET.coreApiUrl,
STACKS_CONTRACT_DEPLOYER_MAINNET,
xlinkContractsDeployerMainnet,
[
"btc-peg-in-endpoint-v2-02",
"btc-peg-out-endpoint-v2-01",
Expand Down
5 changes: 0 additions & 5 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { StacksMainnet, StacksMocknet } from "@stacks/network"

export const STACKS_CONTRACT_DEPLOYER_MAINNET =
"SP2XD7417HGPRTREMKF748VNEQPDRR0RMANB7X1NK"
export const STACKS_CONTRACT_DEPLOYER_TESTNET =
"ST2QXSK64YQX3CQPC530K79XWQ98XFAM9W3XKEH3N"

export const STACKS_MAINNET = new StacksMainnet({
url: "https://stacks-node-api.alexlab.co",
})
Expand Down
28 changes: 14 additions & 14 deletions src/stacksUtils/stxContractAddresses.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import {
STACKS_CONTRACT_DEPLOYER_MAINNET,
STACKS_CONTRACT_DEPLOYER_TESTNET,
} from "../config"
import { KnownChainId, KnownTokenId } from "../utils/types/knownIds"
import { StacksContractAddress } from "../xlinkSdkUtils/types"

const xlinkContractsDeployerMainnet = STACKS_CONTRACT_DEPLOYER_MAINNET
const xlinkContractsDeployerTestnet = STACKS_CONTRACT_DEPLOYER_TESTNET
export const xlinkContractsDeployerMainnet =
"SP2XD7417HGPRTREMKF748VNEQPDRR0RMANB7X1NK"
export const xlinkContractsDeployerTestnet =
"ST2QXSK64YQX3CQPC530K79XWQ98XFAM9W3XKEH3N"

const alexContractDeployerMainnet = "SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM"
const alexContractDeployerTestnet = "ST1J4G6RR643BCG8G8SR6M2D9Z9KXT2NJDRK3FBTK"
export const alexContractDeployerMainnet =
"SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM"
export const alexContractDeployerTestnet =
"ST1J4G6RR643BCG8G8SR6M2D9Z9KXT2NJDRK3FBTK"

const legacyAlexContractDeployerMainnet =
export const legacyAlexContractDeployerMainnet =
"SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9"
const legacyAlexContractDeployerTestnet =
export const legacyAlexContractDeployerTestnet =
"ST1J2JTYXGRMZYNKE40GM87ZCACSPSSEEQVSNB7DC"

export const stxTokenContractAddresses: Record<
Expand Down Expand Up @@ -72,21 +72,21 @@ export const stxTokenContractAddresses: Record<
},
[KnownTokenId.Stacks.vLiSTX]: {
[KnownChainId.Stacks.Mainnet]: {
deployerAddress: legacyAlexContractDeployerMainnet,
deployerAddress: alexContractDeployerMainnet,
contractName: "token-wvlqstx",
},
[KnownChainId.Stacks.Testnet]: {
deployerAddress: legacyAlexContractDeployerTestnet,
deployerAddress: alexContractDeployerTestnet,
contractName: "token-wvlqstx",
},
},
[KnownTokenId.Stacks.vLiALEX]: {
[KnownChainId.Stacks.Mainnet]: {
deployerAddress: xlinkContractsDeployerMainnet,
deployerAddress: alexContractDeployerMainnet,
contractName: "token-wvlialex",
},
[KnownChainId.Stacks.Testnet]: {
deployerAddress: xlinkContractsDeployerTestnet,
deployerAddress: alexContractDeployerTestnet,
contractName: "token-wvlialex",
},
},
Expand Down
17 changes: 8 additions & 9 deletions src/stacksUtils/xlinkContractHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@ import {
executeReadonlyCallFactory,
} from "clarity-codegen"
import { xlinkContracts } from "../../generated/smartContract/contracts_xlink"
import {
STACKS_CONTRACT_DEPLOYER_MAINNET,
STACKS_CONTRACT_DEPLOYER_TESTNET,
STACKS_MAINNET,
STACKS_TESTNET,
} from "../config"
import { STACKS_MAINNET, STACKS_TESTNET } from "../config"
import { BigNumber, BigNumberSource } from "../utils/BigNumber"
import { checkNever } from "../utils/typeHelpers"
import { KnownChainId, KnownTokenId } from "../utils/types/knownIds"
import { StacksContractAddress } from "../xlinkSdkUtils/types"
import { stxTokenContractAddresses } from "./stxContractAddresses"
import {
stxTokenContractAddresses,
xlinkContractsDeployerMainnet,
xlinkContractsDeployerTestnet,
} from "./stxContractAddresses"

const CONTRACT_COMMON_NUMBER_SCALE = 8
export const numberFromStacksContractNumber = (
Expand Down Expand Up @@ -53,13 +52,13 @@ export const getStacksContractCallInfo = (
} => {
if (chainId === KnownChainId.Stacks.Mainnet) {
return {
deployerAddress: STACKS_CONTRACT_DEPLOYER_MAINNET,
deployerAddress: xlinkContractsDeployerMainnet,
network: STACKS_MAINNET,
}
}
if (chainId === KnownChainId.Stacks.Testnet) {
return {
deployerAddress: STACKS_CONTRACT_DEPLOYER_TESTNET,
deployerAddress: xlinkContractsDeployerTestnet,
network: STACKS_TESTNET,
}
}
Expand Down

0 comments on commit d7b6a12

Please sign in to comment.