@stargatefinance/stg-evm-v2 0.0.14 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +5 -2
- package/CHANGELOG.md +7 -0
- package/deploy/001-deploy-asset.ts +129 -0
- package/deploy/utils/deploy-asset.ts +158 -0
- package/deployments/bsc-sandbox-local/CreditMessaging.json +9 -9
- package/deployments/bsc-sandbox-local/FeeLibV1BUSD.json +31 -32
- package/deployments/bsc-sandbox-local/FeeLibV1ETH.json +33 -34
- package/deployments/bsc-sandbox-local/FeeLibV1LUSD.json +33 -34
- package/deployments/bsc-sandbox-local/FeeLibV1USDC.json +33 -34
- package/deployments/bsc-sandbox-local/FeeLibV1USDT.json +31 -32
- package/deployments/bsc-sandbox-local/IntentOFTBUSD.json +11 -11
- package/deployments/bsc-sandbox-local/IntentOFTUSDC.json +14 -14
- package/deployments/bsc-sandbox-local/IntentOFTUSDT.json +11 -11
- package/deployments/bsc-sandbox-local/IntentPoolETH.json +440 -0
- package/deployments/bsc-sandbox-local/IntentPoolLUSD.json +440 -0
- package/deployments/bsc-sandbox-local/OFTTokenBUSD.json +3 -3
- package/deployments/bsc-sandbox-local/OFTTokenSTGRewardMock.json +3 -3
- package/deployments/bsc-sandbox-local/OFTTokenUSDC.json +8 -8
- package/deployments/bsc-sandbox-local/OFTTokenUSDT.json +6 -6
- package/deployments/bsc-sandbox-local/Permit2Mock.json +1 -1
- package/deployments/bsc-sandbox-local/PoolTokenETH.json +597 -0
- package/deployments/bsc-sandbox-local/PoolTokenLUSD.json +597 -0
- package/deployments/bsc-sandbox-local/RewardLib.json +2 -2
- package/deployments/bsc-sandbox-local/RewardRegistryLib.json +2 -2
- package/deployments/bsc-sandbox-local/StargateMultiRewarder.json +34 -34
- package/deployments/bsc-sandbox-local/StargateOFTBUSD.json +35 -23
- package/deployments/bsc-sandbox-local/StargateOFTUSDC.json +38 -26
- package/deployments/bsc-sandbox-local/StargateOFTUSDT.json +35 -23
- package/deployments/bsc-sandbox-local/StargatePoolETH.json +2404 -0
- package/deployments/bsc-sandbox-local/StargatePoolLUSD.json +2404 -0
- package/deployments/bsc-sandbox-local/StargateStaking.json +15 -15
- package/deployments/bsc-sandbox-local/TokenMessaging.json +45 -30
- package/deployments/bsc-sandbox-local/WETH.json +2 -2
- package/deployments/ethereum-sandbox-local/CreditMessaging.json +9 -9
- package/deployments/ethereum-sandbox-local/FeeLibV1BUSD.json +31 -32
- package/deployments/ethereum-sandbox-local/FeeLibV1ETH.json +40 -41
- package/deployments/ethereum-sandbox-local/FeeLibV1LUSD.json +33 -34
- package/deployments/ethereum-sandbox-local/FeeLibV1USDC.json +35 -36
- package/deployments/ethereum-sandbox-local/FeeLibV1USDT.json +40 -41
- package/deployments/ethereum-sandbox-local/IntentOFTBUSD.json +11 -11
- package/deployments/ethereum-sandbox-local/IntentPoolLUSD.json +11 -11
- package/deployments/ethereum-sandbox-local/IntentPoolNative.json +16 -16
- package/deployments/ethereum-sandbox-local/IntentPoolUSDC.json +16 -16
- package/deployments/ethereum-sandbox-local/IntentPoolUSDT.json +24 -24
- package/deployments/ethereum-sandbox-local/OFTTokenBUSD.json +3 -3
- package/deployments/ethereum-sandbox-local/OFTTokenSTGRewardMock.json +3 -3
- package/deployments/ethereum-sandbox-local/Permit2Mock.json +1 -1
- package/deployments/ethereum-sandbox-local/PoolTokenLUSD.json +8 -8
- package/deployments/ethereum-sandbox-local/PoolTokenUSDC.json +7 -7
- package/deployments/ethereum-sandbox-local/PoolTokenUSDT.json +16 -16
- package/deployments/ethereum-sandbox-local/RewardLib.json +2 -2
- package/deployments/ethereum-sandbox-local/RewardRegistryLib.json +2 -2
- package/deployments/ethereum-sandbox-local/StargateMultiRewarder.json +34 -34
- package/deployments/ethereum-sandbox-local/StargateOFTBUSD.json +35 -23
- package/deployments/ethereum-sandbox-local/StargatePoolLUSD.json +91 -27
- package/deployments/ethereum-sandbox-local/StargatePoolNative.json +99 -35
- package/deployments/ethereum-sandbox-local/StargatePoolUSDC.json +96 -32
- package/deployments/ethereum-sandbox-local/StargatePoolUSDT.json +100 -36
- package/deployments/ethereum-sandbox-local/StargateStaking.json +15 -15
- package/deployments/ethereum-sandbox-local/TokenMessaging.json +45 -30
- package/deployments/ethereum-sandbox-local/WETH.json +2 -2
- package/deployments/polygon-sandbox-local/CreditMessaging.json +9 -9
- package/deployments/polygon-sandbox-local/FeeLibV1BUSD.json +31 -32
- package/deployments/polygon-sandbox-local/FeeLibV1ETH.json +38 -39
- package/deployments/polygon-sandbox-local/FeeLibV1LUSD.json +31 -32
- package/deployments/polygon-sandbox-local/FeeLibV1USDC.json +33 -34
- package/deployments/polygon-sandbox-local/FeeLibV1USDT.json +40 -41
- package/deployments/polygon-sandbox-local/IntentOFTBUSD.json +11 -11
- package/deployments/polygon-sandbox-local/IntentOFTETH.json +22 -22
- package/deployments/polygon-sandbox-local/IntentOFTLUSD.json +11 -11
- package/deployments/polygon-sandbox-local/IntentOFTUSDC.json +14 -14
- package/deployments/polygon-sandbox-local/IntentPoolUSDT.json +22 -22
- package/deployments/polygon-sandbox-local/OFTTokenBUSD.json +3 -3
- package/deployments/polygon-sandbox-local/OFTTokenETH.json +12 -12
- package/deployments/polygon-sandbox-local/OFTTokenLUSD.json +6 -6
- package/deployments/polygon-sandbox-local/OFTTokenSTGRewardMock.json +3 -3
- package/deployments/polygon-sandbox-local/OFTTokenUSDC.json +5 -5
- package/deployments/polygon-sandbox-local/Permit2Mock.json +1 -1
- package/deployments/polygon-sandbox-local/PoolTokenUSDT.json +16 -16
- package/deployments/polygon-sandbox-local/RewardLib.json +2 -2
- package/deployments/polygon-sandbox-local/RewardRegistryLib.json +2 -2
- package/deployments/polygon-sandbox-local/StargateMultiRewarder.json +34 -34
- package/deployments/polygon-sandbox-local/StargateOFTBUSD.json +35 -23
- package/deployments/polygon-sandbox-local/StargateOFTETH.json +44 -32
- package/deployments/polygon-sandbox-local/StargateOFTLUSD.json +35 -23
- package/deployments/polygon-sandbox-local/StargateOFTUSDC.json +38 -26
- package/deployments/polygon-sandbox-local/StargatePoolUSDT.json +100 -36
- package/deployments/polygon-sandbox-local/StargateStaking.json +15 -15
- package/deployments/polygon-sandbox-local/TokenMessaging.json +45 -30
- package/deployments/polygon-sandbox-local/WETH.json +2 -2
- package/ops/util.ts +6 -0
- package/package.json +1 -1
- package/test/unitest/peripheral/rewarder/lib/RewardLib.t.sol +17 -0
- package/deploy/001-deploy-stargate.ts +0 -113
- package/deployments/bsc-sandbox-local/IntentOFTETH.json +0 -337
- package/deployments/bsc-sandbox-local/IntentOFTLUSD.json +0 -337
- package/deployments/bsc-sandbox-local/OFTTokenETH.json +0 -557
- package/deployments/bsc-sandbox-local/OFTTokenLUSD.json +0 -557
- package/deployments/bsc-sandbox-local/StargateOFTETH.json +0 -1863
- package/deployments/bsc-sandbox-local/StargateOFTLUSD.json +0 -1863
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
installing solc version "0.8.22"
|
|
2
2
|
Successfully installed solc 0.8.22
|
|
3
3
|
Compiling 260 files with 0.8.22
|
|
4
|
-
Solc 0.8.22 finished in 65.
|
|
4
|
+
Solc 0.8.22 finished in 65.22s
|
|
5
5
|
Compiler run [33msuccessful with warnings:[0m
|
|
6
6
|
[1;33mWarning (3628)[0m[1;37m: This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function.[0m
|
|
7
7
|
[34m-->[0m src/usdc/FiatTokenProxyFlat.sol:215:1:
|
|
@@ -54,7 +54,7 @@ Generating typings for: 136 artifacts in dir: ./ts-src/typechain-types for targe
|
|
|
54
54
|
Successfully generated 322 typings!
|
|
55
55
|
Compiled 114 Solidity files successfully (evm target: paris).
|
|
56
56
|
npm WARN exec The following package was not found and will be installed: @layerzerolabs/export-deployments@0.0.6
|
|
57
|
-
[32minfo[39m: ✓ Generated
|
|
57
|
+
[32minfo[39m: ✓ Generated 47 files:
|
|
58
58
|
[32minfo[39m: /home/runner/work/stargate-v2/stargate-v2/packages/stg-evm-v2/deployed/CreditMessaging.ts
|
|
59
59
|
[32minfo[39m: /home/runner/work/stargate-v2/stargate-v2/packages/stg-evm-v2/deployed/FeeLibV1BUSD.ts
|
|
60
60
|
[32minfo[39m: /home/runner/work/stargate-v2/stargate-v2/packages/stg-evm-v2/deployed/FeeLibV1ETH.ts
|
|
@@ -66,6 +66,7 @@ npm WARN exec The following package was not found and will be installed: @layerz
|
|
|
66
66
|
[32minfo[39m: /home/runner/work/stargate-v2/stargate-v2/packages/stg-evm-v2/deployed/IntentOFTLUSD.ts
|
|
67
67
|
[32minfo[39m: /home/runner/work/stargate-v2/stargate-v2/packages/stg-evm-v2/deployed/IntentOFTUSDC.ts
|
|
68
68
|
[32minfo[39m: /home/runner/work/stargate-v2/stargate-v2/packages/stg-evm-v2/deployed/IntentOFTUSDT.ts
|
|
69
|
+
[32minfo[39m: /home/runner/work/stargate-v2/stargate-v2/packages/stg-evm-v2/deployed/IntentPoolETH.ts
|
|
69
70
|
[32minfo[39m: /home/runner/work/stargate-v2/stargate-v2/packages/stg-evm-v2/deployed/IntentPoolLUSD.ts
|
|
70
71
|
[32minfo[39m: /home/runner/work/stargate-v2/stargate-v2/packages/stg-evm-v2/deployed/IntentPoolNative.ts
|
|
71
72
|
[32minfo[39m: /home/runner/work/stargate-v2/stargate-v2/packages/stg-evm-v2/deployed/IntentPoolUSDC.ts
|
|
@@ -79,6 +80,7 @@ npm WARN exec The following package was not found and will be installed: @layerz
|
|
|
79
80
|
[32minfo[39m: /home/runner/work/stargate-v2/stargate-v2/packages/stg-evm-v2/deployed/OFTTokenUSDC.ts
|
|
80
81
|
[32minfo[39m: /home/runner/work/stargate-v2/stargate-v2/packages/stg-evm-v2/deployed/OFTTokenUSDT.ts
|
|
81
82
|
[32minfo[39m: /home/runner/work/stargate-v2/stargate-v2/packages/stg-evm-v2/deployed/Permit2Mock.ts
|
|
83
|
+
[32minfo[39m: /home/runner/work/stargate-v2/stargate-v2/packages/stg-evm-v2/deployed/PoolTokenETH.ts
|
|
82
84
|
[32minfo[39m: /home/runner/work/stargate-v2/stargate-v2/packages/stg-evm-v2/deployed/PoolTokenLUSD.ts
|
|
83
85
|
[32minfo[39m: /home/runner/work/stargate-v2/stargate-v2/packages/stg-evm-v2/deployed/PoolTokenUSDC.ts
|
|
84
86
|
[32minfo[39m: /home/runner/work/stargate-v2/stargate-v2/packages/stg-evm-v2/deployed/PoolTokenUSDT.ts
|
|
@@ -90,6 +92,7 @@ npm WARN exec The following package was not found and will be installed: @layerz
|
|
|
90
92
|
[32minfo[39m: /home/runner/work/stargate-v2/stargate-v2/packages/stg-evm-v2/deployed/StargateOFTLUSD.ts
|
|
91
93
|
[32minfo[39m: /home/runner/work/stargate-v2/stargate-v2/packages/stg-evm-v2/deployed/StargateOFTUSDC.ts
|
|
92
94
|
[32minfo[39m: /home/runner/work/stargate-v2/stargate-v2/packages/stg-evm-v2/deployed/StargateOFTUSDT.ts
|
|
95
|
+
[32minfo[39m: /home/runner/work/stargate-v2/stargate-v2/packages/stg-evm-v2/deployed/StargatePoolETH.ts
|
|
93
96
|
[32minfo[39m: /home/runner/work/stargate-v2/stargate-v2/packages/stg-evm-v2/deployed/StargatePoolLUSD.ts
|
|
94
97
|
[32minfo[39m: /home/runner/work/stargate-v2/stargate-v2/packages/stg-evm-v2/deployed/StargatePoolNative.ts
|
|
95
98
|
[32minfo[39m: /home/runner/work/stargate-v2/stargate-v2/packages/stg-evm-v2/deployed/StargatePoolUSDC.ts
|
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import assert from 'assert'
|
|
2
|
+
|
|
3
|
+
import { NativeTokenName, StargateType, TokenAddressConfig, getTokenNameEnv } from '@stargatefinance/stg-definitions-v2'
|
|
4
|
+
import { HardhatRuntimeEnvironment } from 'hardhat/types'
|
|
5
|
+
import { DeployFunction } from 'hardhat-deploy/dist/types'
|
|
6
|
+
|
|
7
|
+
import { Chain, EndpointVersion, Network, networkToChain, networkToEndpointId } from '@layerzerolabs/lz-definitions'
|
|
8
|
+
|
|
9
|
+
import { getOFTAssetDeploymentName, getPoolAssetDeploymentName, getTokenDeployName } from '../ops/util'
|
|
10
|
+
import { CONTRACT_STARGATE_TAGS, ERC20 } from '../ts-src'
|
|
11
|
+
|
|
12
|
+
import { getStargateTypeByNetwork } from './util'
|
|
13
|
+
import { deployNativePoolAsset, deployOFTAsset, deployPoolAsset } from './utils/deploy-asset'
|
|
14
|
+
|
|
15
|
+
// FIXME config
|
|
16
|
+
const sharedDecimals = 6
|
|
17
|
+
|
|
18
|
+
const deploy: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
|
|
19
|
+
const tokenName = getTokenNameEnv()
|
|
20
|
+
assert(tokenName, 'Missing token name')
|
|
21
|
+
|
|
22
|
+
const network = hre.network.name as Network
|
|
23
|
+
const chain: Chain = networkToChain(network)
|
|
24
|
+
const stargateType = await getStargateTypeByNetwork(hre.network.name as Network, tokenName)
|
|
25
|
+
|
|
26
|
+
// If we are deploying a native pool, it's quite straightforward
|
|
27
|
+
if (stargateType === StargateType.Native) {
|
|
28
|
+
return deployNativePoolAsset(hre, {
|
|
29
|
+
tokenSymbol: NativeTokenName[chain as keyof typeof NativeTokenName] ?? tokenName,
|
|
30
|
+
sharedDecimals,
|
|
31
|
+
tokenDecimals: 18,
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// For the Pool & OFT we're gonna need some more information
|
|
36
|
+
const tokenAddress =
|
|
37
|
+
// We'll grab the token address either from a list of external token addresses
|
|
38
|
+
getExternalTokenAddress(network, tokenName) ??
|
|
39
|
+
// Or from local deployments if that fails
|
|
40
|
+
//
|
|
41
|
+
// For this we need to also grab the name under which this token should exist
|
|
42
|
+
(await getInternalTokenAddress(hre, getTokenDeployName(tokenName, stargateType)))
|
|
43
|
+
assert(tokenAddress, `Missing pool token address for ${tokenName} on ${network}`)
|
|
44
|
+
|
|
45
|
+
// Now let's get some symbols and decimals
|
|
46
|
+
const tokenProperties = await getTokenProperties(hre, tokenAddress)
|
|
47
|
+
|
|
48
|
+
// TODO You can't get rid of all conditionals at the same time can you
|
|
49
|
+
const isUsdc = tokenName === 'USDC'
|
|
50
|
+
|
|
51
|
+
switch (stargateType) {
|
|
52
|
+
case StargateType.Pool:
|
|
53
|
+
return deployPoolAsset(hre, {
|
|
54
|
+
contractName: isUsdc ? 'StargatePoolUSDC' : 'StargatePool',
|
|
55
|
+
deploymentName: getPoolAssetDeploymentName(tokenName),
|
|
56
|
+
sharedDecimals,
|
|
57
|
+
tokenAddress,
|
|
58
|
+
...tokenProperties,
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
case StargateType.Oft:
|
|
62
|
+
return deployOFTAsset(hre, {
|
|
63
|
+
contractName: isUsdc ? 'StargateOFTUSDC' : 'StargateOFT',
|
|
64
|
+
deploymentName: getOFTAssetDeploymentName(tokenName),
|
|
65
|
+
sharedDecimals,
|
|
66
|
+
tokenAddress,
|
|
67
|
+
...tokenProperties,
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
deploy.tags = CONTRACT_STARGATE_TAGS
|
|
73
|
+
|
|
74
|
+
export default deploy
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Helper function that grabs a token address of an external token,
|
|
78
|
+
* configured using a static address config in `@stargatefinance/stg-definitions-v2`
|
|
79
|
+
*
|
|
80
|
+
* @param {Network} network
|
|
81
|
+
* @param {string} tokenName Short name of a token, e.g. USDC or USDT
|
|
82
|
+
* @returns {string | undefined} Address of an external token or `undefined` if the token has not been configured
|
|
83
|
+
*/
|
|
84
|
+
const getExternalTokenAddress = (network: Network, tokenName: string): string | undefined => {
|
|
85
|
+
const eid = networkToEndpointId(network, EndpointVersion.V2)
|
|
86
|
+
|
|
87
|
+
// FIXME This type assertion is quite nasty, especially since it reults in a non-nullable type for tokenConfig
|
|
88
|
+
const tokenConfig = TokenAddressConfig[eid as keyof typeof TokenAddressConfig]
|
|
89
|
+
|
|
90
|
+
// FIXME Another type assertion in a critical place
|
|
91
|
+
return tokenConfig?.[tokenName as keyof typeof tokenConfig]
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Helper function that grabs a token address from local deployments
|
|
96
|
+
*
|
|
97
|
+
* @param {HardhatRuntimeEnvironment} hre
|
|
98
|
+
* @param {string} tokenDeploymentName The name under which this token should have been deployed
|
|
99
|
+
* @returns {promise<string | undefined>} Address of an external token or undefined if this token has not been deployed
|
|
100
|
+
*/
|
|
101
|
+
const getInternalTokenAddress = async (
|
|
102
|
+
hre: HardhatRuntimeEnvironment,
|
|
103
|
+
tokenDeploymentName: string
|
|
104
|
+
): Promise<string | undefined> => {
|
|
105
|
+
const tokenDeployment = await hre.deployments.getOrNull(tokenDeploymentName)
|
|
106
|
+
|
|
107
|
+
return tokenDeployment?.address
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Helper function that grabs token properties (symbol & decimals)
|
|
112
|
+
* from a deployed ERC20 token
|
|
113
|
+
*
|
|
114
|
+
* @param {HardhatRuntimeEnvironment} hre
|
|
115
|
+
* @param {string} tokenAddress
|
|
116
|
+
*/
|
|
117
|
+
const getTokenProperties = async (
|
|
118
|
+
hre: HardhatRuntimeEnvironment,
|
|
119
|
+
tokenAddress: string
|
|
120
|
+
): Promise<{ tokenDecimals: number; tokenSymbol: string }> => {
|
|
121
|
+
const token = (await hre.ethers.getContractAt(
|
|
122
|
+
'@openzeppelin/contracts/token/ERC20/ERC20.sol:ERC20',
|
|
123
|
+
tokenAddress
|
|
124
|
+
)) as ERC20
|
|
125
|
+
|
|
126
|
+
const [tokenDecimals, tokenSymbol] = await Promise.all([token.decimals(), token.symbol()])
|
|
127
|
+
|
|
128
|
+
return { tokenDecimals, tokenSymbol }
|
|
129
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { Network } from '@layerzerolabs/lz-definitions'
|
|
2
|
+
|
|
3
|
+
import { getNativePoolAssetDeploymentName } from '../../ops/util'
|
|
4
|
+
import { ENDPOINT_CONTRACT_PACKAGE } from '../../ts-src'
|
|
5
|
+
import { getDeployment } from '../util'
|
|
6
|
+
|
|
7
|
+
import type { HardhatRuntimeEnvironment } from 'hardhat/types'
|
|
8
|
+
|
|
9
|
+
interface DeployOFTAssetOptions {
|
|
10
|
+
contractName: 'StargateOFTUSDC' | 'StargateOFT'
|
|
11
|
+
deploymentName: string
|
|
12
|
+
tokenAddress: string
|
|
13
|
+
sharedDecimals: number
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const deployOFTAsset = async (
|
|
17
|
+
hre: HardhatRuntimeEnvironment,
|
|
18
|
+
{ contractName, deploymentName, tokenAddress, sharedDecimals }: DeployOFTAssetOptions
|
|
19
|
+
) => {
|
|
20
|
+
const { deployments } = hre
|
|
21
|
+
const { deployer } = await hre.getNamedAccounts()
|
|
22
|
+
|
|
23
|
+
// Let's get em EndpointV2 deployment properties
|
|
24
|
+
//
|
|
25
|
+
// TODO Replace with native deployments.get once we have eid configured in hardhat networks
|
|
26
|
+
const endpointAddress = await getEndpointV2Address(hre)
|
|
27
|
+
|
|
28
|
+
// Let the world know we're doing something
|
|
29
|
+
console.table({
|
|
30
|
+
Asset: deploymentName,
|
|
31
|
+
Contract: contractName,
|
|
32
|
+
Deployer: deployer,
|
|
33
|
+
Endpoint: endpointAddress,
|
|
34
|
+
'Shared Decimals': sharedDecimals,
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
await deployments.deploy(deploymentName, {
|
|
38
|
+
contract: contractName,
|
|
39
|
+
from: deployer,
|
|
40
|
+
args: [tokenAddress, sharedDecimals, endpointAddress, deployer],
|
|
41
|
+
log: true,
|
|
42
|
+
waitConfirmations: 1,
|
|
43
|
+
skipIfAlreadyDeployed: true,
|
|
44
|
+
gasPrice: await hre.ethers.provider.getGasPrice(),
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface DeployNativePoolAssetOptions {
|
|
49
|
+
deploymentName?: string
|
|
50
|
+
tokenSymbol: string
|
|
51
|
+
sharedDecimals: number
|
|
52
|
+
tokenDecimals: number
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const deployNativePoolAsset = async (
|
|
56
|
+
hre: HardhatRuntimeEnvironment,
|
|
57
|
+
{
|
|
58
|
+
deploymentName = getNativePoolAssetDeploymentName(),
|
|
59
|
+
tokenSymbol,
|
|
60
|
+
sharedDecimals,
|
|
61
|
+
tokenDecimals,
|
|
62
|
+
}: DeployNativePoolAssetOptions
|
|
63
|
+
) => {
|
|
64
|
+
const contractName = 'StargatePoolNative'
|
|
65
|
+
const { deployments } = hre
|
|
66
|
+
const { deployer } = await hre.getNamedAccounts()
|
|
67
|
+
|
|
68
|
+
// Let's get em EndpointV2 deployment properties
|
|
69
|
+
//
|
|
70
|
+
// TODO Replace with native deployments.get once we have eid configured in hardhat networks
|
|
71
|
+
const endpointAddress = await getEndpointV2Address(hre)
|
|
72
|
+
|
|
73
|
+
// Let the world know we're doing something
|
|
74
|
+
console.table({
|
|
75
|
+
Asset: deploymentName,
|
|
76
|
+
Contract: contractName,
|
|
77
|
+
Deployer: deployer,
|
|
78
|
+
Endpoint: endpointAddress,
|
|
79
|
+
'Token Symbol': tokenSymbol,
|
|
80
|
+
'Shared Decimals': sharedDecimals,
|
|
81
|
+
'Token Decimals': tokenDecimals,
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
await deployments.deploy(deploymentName, {
|
|
85
|
+
from: deployer,
|
|
86
|
+
contract: contractName,
|
|
87
|
+
args: [
|
|
88
|
+
`Stargate ${tokenSymbol} Vault-LP`,
|
|
89
|
+
`S*SG${tokenSymbol}`,
|
|
90
|
+
tokenDecimals,
|
|
91
|
+
sharedDecimals,
|
|
92
|
+
endpointAddress,
|
|
93
|
+
deployer,
|
|
94
|
+
],
|
|
95
|
+
log: true,
|
|
96
|
+
waitConfirmations: 1,
|
|
97
|
+
skipIfAlreadyDeployed: true,
|
|
98
|
+
gasPrice: await hre.ethers.provider.getGasPrice(),
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
interface DeployPoolAssetOptions {
|
|
103
|
+
contractName: 'StargatePoolUSDC' | 'StargatePool'
|
|
104
|
+
deploymentName: string
|
|
105
|
+
tokenAddress: string
|
|
106
|
+
tokenSymbol: string
|
|
107
|
+
sharedDecimals: number
|
|
108
|
+
tokenDecimals: number
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export const deployPoolAsset = async (
|
|
112
|
+
hre: HardhatRuntimeEnvironment,
|
|
113
|
+
{ contractName, deploymentName, tokenAddress, tokenSymbol, sharedDecimals, tokenDecimals }: DeployPoolAssetOptions
|
|
114
|
+
) => {
|
|
115
|
+
const { deployments } = hre
|
|
116
|
+
const { deployer } = await hre.getNamedAccounts()
|
|
117
|
+
|
|
118
|
+
// Let's get em EndpointV2 deployment properties
|
|
119
|
+
//
|
|
120
|
+
// TODO Replace with native deployments.get once we have eid configured in hardhat networks
|
|
121
|
+
const endpointAddress = await getEndpointV2Address(hre)
|
|
122
|
+
|
|
123
|
+
// Let the world know we're doing something
|
|
124
|
+
console.table({
|
|
125
|
+
Asset: deploymentName,
|
|
126
|
+
Contract: contractName,
|
|
127
|
+
Deployer: deployer,
|
|
128
|
+
Endpoint: endpointAddress,
|
|
129
|
+
'Token Address': tokenAddress,
|
|
130
|
+
'Token Symbol': tokenSymbol,
|
|
131
|
+
'Shared Decimals': sharedDecimals,
|
|
132
|
+
'Token Decimals': tokenDecimals,
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
await deployments.deploy(deploymentName, {
|
|
136
|
+
contract: contractName,
|
|
137
|
+
from: deployer,
|
|
138
|
+
args: [
|
|
139
|
+
`Stargate ${tokenSymbol} Vault-LP`,
|
|
140
|
+
`S*SG${tokenSymbol}`,
|
|
141
|
+
tokenAddress,
|
|
142
|
+
tokenDecimals,
|
|
143
|
+
sharedDecimals,
|
|
144
|
+
endpointAddress,
|
|
145
|
+
deployer,
|
|
146
|
+
],
|
|
147
|
+
log: true,
|
|
148
|
+
waitConfirmations: 1,
|
|
149
|
+
skipIfAlreadyDeployed: true,
|
|
150
|
+
gasPrice: await hre.ethers.provider.getGasPrice(),
|
|
151
|
+
})
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const getEndpointV2Address = async (hre: HardhatRuntimeEnvironment) => {
|
|
155
|
+
const deployment = await getDeployment(hre.network.name as Network, ENDPOINT_CONTRACT_PACKAGE, 'EndpointV2')
|
|
156
|
+
|
|
157
|
+
return deployment.address
|
|
158
|
+
}
|