-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Implement erc1155 deployment (#222)
- Loading branch information
1 parent
1fe57a3
commit 6e16f36
Showing
9 changed files
with
417 additions
and
212 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
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,48 @@ | ||
// The Licensed Work is (c) 2022 Sygma | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
const Utils = require("./utils"); | ||
|
||
const BridgeContract = artifacts.require("Bridge"); | ||
const ERC1155HandlerContract = artifacts.require("ERC1155Handler"); | ||
|
||
module.exports = async function (deployer, network) { | ||
const networksConfig = Utils.getNetworksConfig(); | ||
// trim suffix from network name and fetch current network config | ||
const currentNetworkName = network.split("-")[0]; | ||
const currentNetworkConfig = networksConfig[currentNetworkName]; | ||
|
||
delete networksConfig[currentNetworkName]; | ||
// fetch deployed contracts addresses | ||
const bridgeInstance = await BridgeContract.deployed(); | ||
|
||
// deploy generic handler | ||
const erc1155HandlerInstance = await deployer.deploy( | ||
ERC1155HandlerContract, | ||
bridgeInstance.address | ||
); | ||
|
||
console.table({ | ||
|
||
"ERC1155Handler Address": erc1155HandlerInstance.address, | ||
|
||
}); | ||
|
||
for (const erc1155 of currentNetworkConfig.erc1155) { | ||
await Utils.setupErc1155( | ||
deployer, | ||
erc1155, | ||
bridgeInstance, | ||
erc1155HandlerInstance | ||
); | ||
|
||
console.log( | ||
"-------------------------------------------------------------------------------" | ||
); | ||
console.log("ERC1155 address:", "\t", erc1155.address); | ||
console.log("ResourceID:", "\t", erc1155.resourceID); | ||
console.log( | ||
"-------------------------------------------------------------------------------" | ||
); | ||
} | ||
}; |
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,34 @@ | ||
// The Licensed Work is (c) 2022 Sygma | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
const Utils = require("./utils"); | ||
|
||
const BasicFeeHandlerContract = artifacts.require("BasicFeeHandler"); | ||
const PercentageFeeHandler = artifacts.require("PercentageERC20FeeHandlerEVM"); | ||
const FeeRouterContract = artifacts.require("FeeHandlerRouter"); | ||
|
||
module.exports = async function (deployer, network) { | ||
const networksConfig = Utils.getNetworksConfig(); | ||
// trim suffix from network name and fetch current network config | ||
const currentNetworkName = network.split("-")[0]; | ||
const currentNetworkConfig = networksConfig[currentNetworkName]; | ||
|
||
delete networksConfig[currentNetworkName]; | ||
// fetch deployed contracts addresses | ||
const basicFeeHandlerInstance = await BasicFeeHandlerContract.deployed() | ||
const percentageFeeHandlerInstance = await PercentageFeeHandler.deployed() | ||
const feeRouterInstance = await FeeRouterContract.deployed() | ||
|
||
for(const fee of currentNetworkConfig.fee) { | ||
console.log(`registering resource ${fee.resourceID} for destination domain | ||
${fee.toDomain} using feeHandler: ${basicFeeHandlerInstance.address}`) | ||
if (fee.type == "basic") { | ||
await feeRouterInstance.adminSetResourceHandler(fee.toDomain, fee.resourceID, basicFeeHandlerInstance.address) | ||
await basicFeeHandlerInstance.changeFee(fee.toDomain, fee.resourceID, fee.feeAmount) | ||
} else if (fee.type == "percentage") { | ||
await feeRouterInstance.adminSetResourceHandler( | ||
fee.toDomain, fee.resourceID, percentageFeeHandlerInstance.address) | ||
await percentageFeeHandlerInstance.changeFee(fee.toDomain, fee.resourceID, fee.feeAmount) | ||
} | ||
} | ||
}; |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.