Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Implement erc1155 deployment #222

Merged
merged 4 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion migrations/2_deploy_contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const PausableContract = artifacts.require("Pausable");
const BridgeContract = artifacts.require("Bridge");
const ERC20HandlerContract = artifacts.require("ERC20Handler");
const ERC721HandlerContract = artifacts.require("ERC721Handler");

const PermissionedGenericHandlerContract = artifacts.require(
"PermissionedGenericHandler"
);
Expand Down Expand Up @@ -161,7 +162,6 @@ module.exports = async function (deployer, network) {
}
}


// set MPC address
if (currentNetworkConfig.MPCAddress)
await bridgeInstance.endKeygen(currentNetworkConfig.MPCAddress);
Expand Down
48 changes: 48 additions & 0 deletions migrations/5_deploy_erc1155.js
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(
"-------------------------------------------------------------------------------"
);
}
};
34 changes: 34 additions & 0 deletions migrations/6_register_routes.js
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.
Loading
Loading