|
|
@ -44,7 +44,9 @@ import { |
|
|
|
import { |
|
|
|
import { |
|
|
|
HypERC20Factories, |
|
|
|
HypERC20Factories, |
|
|
|
HypERC721Factories, |
|
|
|
HypERC721Factories, |
|
|
|
|
|
|
|
hypERC20contracts, |
|
|
|
hypERC20factories, |
|
|
|
hypERC20factories, |
|
|
|
|
|
|
|
hypERC721contracts, |
|
|
|
hypERC721factories, |
|
|
|
hypERC721factories, |
|
|
|
} from './contracts'; |
|
|
|
} from './contracts'; |
|
|
|
|
|
|
|
|
|
|
@ -134,27 +136,29 @@ export class HypERC20Deployer extends GasRouterDeployer< |
|
|
|
chain: ChainName, |
|
|
|
chain: ChainName, |
|
|
|
config: HypERC20CollateralConfig, |
|
|
|
config: HypERC20CollateralConfig, |
|
|
|
): Promise<HypERC20Collateral> { |
|
|
|
): Promise<HypERC20Collateral> { |
|
|
|
let contractName: |
|
|
|
let tokenType: |
|
|
|
| TokenType.fastCollateral |
|
|
|
| TokenType.fastCollateral |
|
|
|
| TokenType.collateral |
|
|
|
| TokenType.collateral |
|
|
|
| TokenType.collateralVault; |
|
|
|
| TokenType.collateralVault; |
|
|
|
switch (config.type) { |
|
|
|
switch (config.type) { |
|
|
|
case TokenType.fastSynthetic || TokenType.fastCollateral: |
|
|
|
case TokenType.fastSynthetic || TokenType.fastCollateral: |
|
|
|
contractName = TokenType.fastCollateral; |
|
|
|
tokenType = TokenType.fastCollateral; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case TokenType.collateral: |
|
|
|
case TokenType.collateral: |
|
|
|
contractName = TokenType.collateral; |
|
|
|
tokenType = TokenType.collateral; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case TokenType.collateralVault: |
|
|
|
case TokenType.collateralVault: |
|
|
|
contractName = TokenType.collateralVault; |
|
|
|
tokenType = TokenType.collateralVault; |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
throw new Error(`Unknown collateral type ${config.type}`); |
|
|
|
throw new Error(`Unknown collateral type ${config.type}`); |
|
|
|
} |
|
|
|
} |
|
|
|
return this.deployContract(chain, contractName, [ |
|
|
|
return this.deployContractWithName( |
|
|
|
config.token, |
|
|
|
chain, |
|
|
|
config.mailbox, |
|
|
|
tokenType, |
|
|
|
]); |
|
|
|
hypERC20contracts[tokenType], |
|
|
|
|
|
|
|
[config.token, config.mailbox], |
|
|
|
|
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected async deployNative( |
|
|
|
protected async deployNative( |
|
|
@ -162,12 +166,19 @@ export class HypERC20Deployer extends GasRouterDeployer< |
|
|
|
config: HypNativeConfig, |
|
|
|
config: HypNativeConfig, |
|
|
|
): Promise<HypNative> { |
|
|
|
): Promise<HypNative> { |
|
|
|
if (config.scale) { |
|
|
|
if (config.scale) { |
|
|
|
return this.deployContract(chain, TokenType.nativeScaled, [ |
|
|
|
return this.deployContractWithName( |
|
|
|
config.scale, |
|
|
|
chain, |
|
|
|
config.mailbox, |
|
|
|
TokenType.nativeScaled, |
|
|
|
]); |
|
|
|
hypERC20contracts[TokenType.nativeScaled], |
|
|
|
|
|
|
|
[config.scale, config.mailbox], |
|
|
|
|
|
|
|
); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return this.deployContract(chain, TokenType.native, [config.mailbox]); |
|
|
|
return this.deployContractWithName( |
|
|
|
|
|
|
|
chain, |
|
|
|
|
|
|
|
TokenType.native, |
|
|
|
|
|
|
|
hypERC20contracts[TokenType.native], |
|
|
|
|
|
|
|
[config.mailbox], |
|
|
|
|
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -175,9 +186,13 @@ export class HypERC20Deployer extends GasRouterDeployer< |
|
|
|
chain: ChainName, |
|
|
|
chain: ChainName, |
|
|
|
config: HypERC20Config, |
|
|
|
config: HypERC20Config, |
|
|
|
): Promise<HypERC20> { |
|
|
|
): Promise<HypERC20> { |
|
|
|
const router: HypERC20 = await this.deployContract( |
|
|
|
const tokenType = isFastConfig(config) |
|
|
|
|
|
|
|
? TokenType.fastSynthetic |
|
|
|
|
|
|
|
: TokenType.synthetic; |
|
|
|
|
|
|
|
const router: HypERC20 = await this.deployContractWithName( |
|
|
|
chain, |
|
|
|
chain, |
|
|
|
isFastConfig(config) ? TokenType.fastSynthetic : TokenType.synthetic, |
|
|
|
tokenType, |
|
|
|
|
|
|
|
hypERC20contracts[tokenType], |
|
|
|
[config.decimals, config.mailbox], |
|
|
|
[config.decimals, config.mailbox], |
|
|
|
); |
|
|
|
); |
|
|
|
try { |
|
|
|
try { |
|
|
@ -326,9 +341,13 @@ export class HypERC721Deployer extends GasRouterDeployer< |
|
|
|
chain: ChainName, |
|
|
|
chain: ChainName, |
|
|
|
config: HypERC721CollateralConfig, |
|
|
|
config: HypERC721CollateralConfig, |
|
|
|
): Promise<HypERC721Collateral> { |
|
|
|
): Promise<HypERC721Collateral> { |
|
|
|
return this.deployContract( |
|
|
|
const tokenType = isUriConfig(config) |
|
|
|
|
|
|
|
? TokenType.collateralUri |
|
|
|
|
|
|
|
: TokenType.collateral; |
|
|
|
|
|
|
|
return this.deployContractWithName( |
|
|
|
chain, |
|
|
|
chain, |
|
|
|
isUriConfig(config) ? TokenType.collateralUri : TokenType.collateral, |
|
|
|
tokenType, |
|
|
|
|
|
|
|
hypERC721contracts[tokenType], |
|
|
|
[config.token, config.mailbox], |
|
|
|
[config.token, config.mailbox], |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
@ -337,9 +356,13 @@ export class HypERC721Deployer extends GasRouterDeployer< |
|
|
|
chain: ChainName, |
|
|
|
chain: ChainName, |
|
|
|
config: HypERC721Config, |
|
|
|
config: HypERC721Config, |
|
|
|
): Promise<HypERC721> { |
|
|
|
): Promise<HypERC721> { |
|
|
|
const router = await this.deployContract( |
|
|
|
const tokenType = isUriConfig(config) |
|
|
|
|
|
|
|
? TokenType.syntheticUri |
|
|
|
|
|
|
|
: TokenType.synthetic; |
|
|
|
|
|
|
|
const router = await this.deployContractWithName( |
|
|
|
chain, |
|
|
|
chain, |
|
|
|
isUriConfig(config) ? TokenType.syntheticUri : TokenType.synthetic, |
|
|
|
tokenType, |
|
|
|
|
|
|
|
hypERC721contracts[tokenType], |
|
|
|
[config.mailbox], |
|
|
|
[config.mailbox], |
|
|
|
); |
|
|
|
); |
|
|
|
await this.multiProvider.handleTx( |
|
|
|
await this.multiProvider.handleTx( |
|
|
|