Skip to content

Commit

Permalink
Merge pull request #5 from venture23-aleo/develop
Browse files Browse the repository at this point in the history
Deployement IAM policy change
  • Loading branch information
naneey authored Sep 13, 2024
2 parents a500258 + 70cce11 commit c69feb9
Show file tree
Hide file tree
Showing 18 changed files with 258 additions and 88 deletions.
3 changes: 2 additions & 1 deletion scripts/aws/DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ Reference: [Creating and Attaching IAM Policy to user](https://docs.aws.amazon.c
"secretsmanager:DescribeSecret",
"secretsmanager:GetSecretValue",
"secretsmanager:CreateSecret",
"secretsmanager:ListSecrets"
"secretsmanager:ListSecrets",
"secretsmanager:UpdateSecret"
],
"Resource": "*"
},
Expand Down
16 changes: 0 additions & 16 deletions solidity/compiler_config.json

This file was deleted.

2 changes: 0 additions & 2 deletions solidity/contracts/main/Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ contract Bridge is
) public initializer {
__Ownable_init_unchained();
__Pausable_init_unchained();
// __AttestorManager_init();
// __BridgeTokenServiceManager_init();
destinationChainId = _destChainId;
_transferOwnership(_owner);
}
Expand Down
4 changes: 2 additions & 2 deletions solidity/scripts/deploy/addAttestor.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ async function main() {
process.env.PROVIDER
);
const deployerSigner = new ethers.Wallet(process.env.DEPLOYER_PRIVATE_KEY, provider);
// Array of 5 attestors
const attestor = process.env.ATTESTOR1;

const attestor = process.env.ATTESTOR2;
const newQuorumRequired = process.env.NEW_QUORUM_REQUIRED;

// Get the contract factory for the "Bridge" contract
Expand Down
2 changes: 1 addition & 1 deletion solidity/scripts/deploy/addTokenUSDT.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async function main() {
const tokenAddress = process.env.USDT_ADDR;
const vault = process.env.ERC20VAULTSERVICE_PROXY_ADDRESS_USDT;
const destChainId = process.env.ALEO_CHAINID;
const destTokenAddress = process.env.DEST_TOKEN_ADDRESS_WETH;
const destTokenAddress = process.env.DEST_TOKEN_ADDRESS_WUSDT;
const destTokenService = process.env.DEST_TOKENSERVICE;
const min = process.env.MIN_WUSDT;
const max = process.env.MAX_WUSDT;
Expand Down
25 changes: 20 additions & 5 deletions solidity/scripts/deploy/deployBlackListService.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import hardhat from 'hardhat';
const { ethers } = hardhat;
const { ethers, run } = hardhat;
import * as dotenv from "dotenv";
dotenv.config();
import { updateEnvFile } from "../multisig/utils.js";
Expand All @@ -18,18 +18,33 @@ async function main() {
console.log("Deploying BlacklistService Impl and Proxy...");

const blackListServiceImpl = await BlackListService.deploy();
await blackListServiceImpl.deployed();
updateEnvFile("BLACKLISTSERVICE_IMPLEMENTATION_ADDRESS", blackListServiceImpl.address)
await blackListServiceImpl.deployTransaction.wait(3);
console.log("BlackListService Impl Deployed to: ", blackListServiceImpl.address);
// Verification process
console.log("Verifying impl contract...");
await run("verify:verify", {
address: blackListServiceImpl.address,
constructorArguments: [], // Pass the constructor arguments here
contract: "contracts/main/tokenservice/BlackListService.sol:BlackListService"
});

updateEnvFile("BLACKLISTSERVICE_IMPLEMENTATION_ADDRESS", blackListServiceImpl.address)

const ProxyContract = await ethers.getContractFactory("ProxyContract");
const initializeData = new ethers.utils.Interface(BlackListService.interface.format()).encodeFunctionData("BlackList_init", [usdc, usdt, deployerSigner.address]);

const blackListServiceProxy = await ProxyContract.deploy(blackListServiceImpl.address, initializeData);
await blackListServiceProxy.deployed();
await blackListServiceProxy.deployTransaction.wait(3);
console.log("BlackListService Proxy Deployed to: ", blackListServiceProxy.address);
console.log("Verifying proxy contract...");

await run("verify:verify", {
address: blackListServiceProxy.address,
constructorArguments: [blackListServiceImpl.address, initializeData], // Pass the constructor arguments here
contract: "contracts/proxies/Proxy.sol:ProxyContract"
});

updateEnvFile("BLACKLISTSERVICE_PROXY_ADDRESS", blackListServiceProxy.address)
console.log("BlackListService Proxy Deployed to: ", blackListServiceProxy.address);
}
main()
.then(() => process.exit(0))
Expand Down
23 changes: 19 additions & 4 deletions solidity/scripts/deploy/deployBridge.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import hardhat from 'hardhat';
const { ethers } = hardhat;
const { ethers, run } = hardhat;
import * as dotenv from "dotenv";
dotenv.config();
import { updateEnvFile } from "../multisig/utils.js";
Expand All @@ -21,18 +21,33 @@ async function main() {
console.log("Deploying Bridge Impl and Proxy...");

const bridgeImpl = await Bridge.deploy();
await bridgeImpl.deployed();
await bridgeImpl.deployTransaction.wait(3);
console.log("Bridge Impl Deployed to: ", bridgeImpl.address);
// Verification process
console.log("Verifying impl contract...");
await run("verify:verify", {
address: bridgeImpl.address,
constructorArguments: [], // Pass the constructor arguments here
contract: "contracts/main/Bridge.sol:Bridge"
});

updateEnvFile("TOKENBRIDGE_IMPLEMENTATION_ADDRESS", bridgeImpl.address);
const ProxyContract = await ethers.getContractFactory("ProxyContract");

const initializeData = new ethers.utils.Interface(Bridge.interface.format()).encodeFunctionData("Bridge_init", [destChainId, deployerSigner.address]);

const bridgeProxy = await ProxyContract.deploy(bridgeImpl.address, initializeData);
await bridgeProxy.deployed();
await bridgeProxy.deployTransaction.wait(3);

updateEnvFile("TOKENBRIDGE_PROXY_ADDRESS", bridgeProxy.address)
console.log("Bridge Proxy Deployed to: ", bridgeProxy.address);
console.log("Verifying proxy contract...");

await run("verify:verify", {
address: bridgeProxy.address,
constructorArguments: [bridgeImpl.address, initializeData], // Pass the constructor arguments here
contract: "contracts/proxies/Proxy.sol:ProxyContract"
});
updateEnvFile("TOKENBRIDGE_PROXY_ADDRESS", bridgeProxy.address)
}
main()
.then(() => process.exit(0))
Expand Down
29 changes: 22 additions & 7 deletions solidity/scripts/deploy/deployERC20VaultServiceUSDC.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import hardhat from 'hardhat';
const { ethers } = hardhat;
const { ethers, run } = hardhat;
import * as dotenv from "dotenv";
dotenv.config();
import { updateEnvFile } from "../multisig/utils.js";
Expand All @@ -16,22 +16,37 @@ async function main() {
console.log("Deploying Erc20VaultServiceUSDC Impl and Proxy...");

const erc20VaultServiceImpl = await Erc20VaultService.deploy();
await erc20VaultServiceImpl.deployed();
updateEnvFile("ERC20VAULTSERVICE_IMPL_ADDRESS_USDC", erc20VaultServiceImpl.address)
await erc20VaultServiceImpl.deployTransaction.wait(3);
console.log("Erc20VaultServiceUSDC Impl Deployed to: ", erc20VaultServiceImpl.address);
// Verification process
console.log("Verifying impl contract...");
await run("verify:verify", {
address: erc20VaultServiceImpl.address,
constructorArguments: [], // Pass the constructor arguments here
contract: "contracts/main/tokenservice/vault/Erc20VaultService.sol:Erc20VaultService"
});

updateEnvFile("ERC20VAULTSERVICE_IMPL_ADDRESS_USDC", erc20VaultServiceImpl.address)

const ProxyContract = await ethers.getContractFactory("ProxyContract");

const initializeData = new ethers.utils.Interface(Erc20VaultService.interface.format()).encodeFunctionData("Erc20VaultService_init", [tokenAddr, "ERC20VAULT", deployerSigner.address]);
const initializeData = new ethers.utils.Interface(Erc20VaultService.interface.format()).encodeFunctionData("Erc20VaultService_init", [tokenAddr, "ERC20VAULTUSDC", deployerSigner.address]);
const erc20VaultServiceProxy = await ProxyContract.deploy(erc20VaultServiceImpl.address, initializeData);
await erc20VaultServiceProxy.deployed();
await erc20VaultServiceProxy.deployTransaction.wait(3);
console.log("Erc20VaultServiceUSDC Proxy Deployed to: ", erc20VaultServiceProxy.address);
console.log("Verifying proxy contract...");

await run("verify:verify", {
address: erc20VaultServiceProxy.address,
constructorArguments: [erc20VaultServiceImpl.address, initializeData], // Pass the constructor arguments here
contract: "contracts/proxies/Proxy.sol:ProxyContract"
});

updateEnvFile("ERC20VAULTSERVICE_PROXY_ADDRESS_USDC", erc20VaultServiceProxy.address)
console.log("Erc20VaultServiceUSDC Proxy Deployed to: ", erc20VaultServiceProxy.address);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
});
28 changes: 22 additions & 6 deletions solidity/scripts/deploy/deployERC20VaultServiceUSDT.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import hardhat from 'hardhat';
const { ethers } = hardhat;
const { ethers, run } = hardhat;
import * as dotenv from "dotenv";
dotenv.config();
import { updateEnvFile } from "../multisig/utils.js";
Expand All @@ -16,18 +16,34 @@ async function main() {
console.log("Deploying Erc20VaultServiceUSDT Impl and Proxy...");

const erc20VaultServiceImpl = await Erc20VaultService.deploy();
await erc20VaultServiceImpl.deployed();
updateEnvFile("ERC20VAULTSERVICE_IMPL_ADDRESS_USDT", erc20VaultServiceImpl.address)
await erc20VaultServiceImpl.deployTransaction.wait(3);
console.log("Erc20VaultServiceUSDT Impl Deployed to: ", erc20VaultServiceImpl.address);
// Verification process
console.log("Verifying impl contract...");
await run("verify:verify", {
address: erc20VaultServiceImpl.address,
constructorArguments: [], // Pass the constructor arguments here
contract: "contracts/main/tokenservice/vault/Erc20VaultService.sol:Erc20VaultService"
});

updateEnvFile("ERC20VAULTSERVICE_IMPL_ADDRESS_USDT", erc20VaultServiceImpl.address);

const ProxyContract = await ethers.getContractFactory("ProxyContract");

const initializeData = new ethers.utils.Interface(Erc20VaultService.interface.format()).encodeFunctionData("Erc20VaultService_init", [tokenAddr, "ERC20VAULT", deployerSigner.address]);
const initializeData = new ethers.utils.Interface(Erc20VaultService.interface.format()).encodeFunctionData("Erc20VaultService_init", [tokenAddr, "ERC20VAULTUSDT", deployerSigner.address]);
const erc20VaultServiceProxy = await ProxyContract.deploy(erc20VaultServiceImpl.address, initializeData);
await erc20VaultServiceProxy.deployed();
await erc20VaultServiceProxy.deployTransaction.wait(3);

updateEnvFile("ERC20VAULTSERVICE_PROXY_ADDRESS_USDT", erc20VaultServiceProxy.address)
console.log("Erc20VaultServiceUSDT Proxy Deployed to: ", erc20VaultServiceProxy.address);
console.log("Verifying proxy contract...");

await run("verify:verify", {
address: erc20VaultServiceProxy.address,
constructorArguments: [erc20VaultServiceImpl.address, initializeData], // Pass the constructor arguments here
contract: "contracts/proxies/Proxy.sol:ProxyContract"
});

updateEnvFile("ERC20VAULTSERVICE_PROXY_ADDRESS_USDT", erc20VaultServiceProxy.address);
}
main()
.then(() => process.exit(0))
Expand Down
23 changes: 18 additions & 5 deletions solidity/scripts/deploy/deployETHVaultService.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import hardhat from 'hardhat';
const { ethers } = hardhat;
const { ethers, run } = hardhat;
import * as dotenv from "dotenv";
dotenv.config();
import { updateEnvFile } from "../multisig/utils.js";
Expand All @@ -15,18 +15,31 @@ async function main() {
console.log("Deploying EthVaultService Impl and Proxy...");

const ethVaultServiceImpl = await ETHVaultService.deploy();
await ethVaultServiceImpl.deployed();
updateEnvFile("ETHVAULTSERVICE_IMPL_ADDRESS", ethVaultServiceImpl.address)
await ethVaultServiceImpl.deployTransaction.wait(3);
console.log("ETHVaultService Impl Deployed to: ", ethVaultServiceImpl.address);
console.log("Verifying impl contract...");
await run("verify:verify", {
address: ethVaultServiceImpl.address,
constructorArguments: [], // Pass the constructor arguments here
contract: "contracts/main/tokenservice/vault/EthVaultService.sol:EthVaultService"
});
updateEnvFile("ETHVAULTSERVICE_IMPL_ADDRESS", ethVaultServiceImpl.address)

const ProxyContract = await ethers.getContractFactory("ProxyContract");

const initializeData = new ethers.utils.Interface(ETHVaultService.interface.format()).encodeFunctionData("EthVaultService_init", ["ETHVAULT", deployerSigner.address]);
const ethVaultServiceProxy = await ProxyContract.deploy(ethVaultServiceImpl.address, initializeData);
await ethVaultServiceProxy.deployed();
await ethVaultServiceProxy.deployTransaction.wait(3);

updateEnvFile("ETHVAULTSERVICE_PROXY_ADDRESS", ethVaultServiceProxy.address)
console.log("ETHVaultService Proxy Deployed to: ", ethVaultServiceProxy.address);
console.log("Verifying proxy contract...");

await run("verify:verify", {
address: ethVaultServiceProxy.address,
constructorArguments: [ethVaultServiceImpl.address, initializeData], // Pass the constructor arguments here
contract: "contracts/proxies/Proxy.sol:ProxyContract"
});
updateEnvFile("ETHVAULTSERVICE_PROXY_ADDRESS", ethVaultServiceProxy.address)
}
main()
.then(() => process.exit(0))
Expand Down
23 changes: 18 additions & 5 deletions solidity/scripts/deploy/deployHolding.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import hardhat from 'hardhat';
const { ethers } = hardhat;
const { ethers, run } = hardhat;
import * as dotenv from "dotenv";
dotenv.config();
import { updateEnvFile } from "../multisig/utils.js";
Expand All @@ -15,18 +15,31 @@ async function main() {
console.log("Deploying Holding Impl and Proxy...");

const holdingImpl = await Holding.deploy();
await holdingImpl.deployed();
updateEnvFile("HOLDING_IMPLEMENTATION_ADDRESS", holdingImpl.address);
await holdingImpl.deployTransaction.wait(3);
console.log("Holding Impl Deployed to: ", holdingImpl.address);
console.log("Verifying impl contract...");
await run("verify:verify", {
address: holdingImpl.address,
constructorArguments: [], // Pass the constructor arguments here
contract: "contracts/main/Holding.sol:Holding"
});
updateEnvFile("HOLDING_IMPLEMENTATION_ADDRESS", holdingImpl.address);

const ProxyContract = await ethers.getContractFactory("ProxyContract");

const initializeData = new ethers.utils.Interface(Holding.interface.format()).encodeFunctionData("Holding_init", [process.env.TOKENSERVICE_PROXY_ADDRESS, deployerSigner.address]);
const holdingProxy = await ProxyContract.deploy(holdingImpl.address, initializeData);
await holdingProxy.deployed();
await holdingProxy.deployTransaction.wait(3);

updateEnvFile("HOLDING_PROXY_ADDRESS", holdingProxy.address);
console.log("Holding Proxy Deployed to: ", holdingProxy.address);
console.log("Verifying proxy contract...");

await run("verify:verify", {
address: holdingProxy.address,
constructorArguments: [holdingImpl.address, initializeData], // Pass the constructor arguments here
contract: "contracts/proxies/Proxy.sol:ProxyContract"
});
updateEnvFile("HOLDING_PROXY_ADDRESS", holdingProxy.address);
}
main()
.then(() => process.exit(0))
Expand Down
22 changes: 18 additions & 4 deletions solidity/scripts/deploy/deployTokenService.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import hardhat from 'hardhat';
const { ethers } = hardhat;
const { ethers, run } = hardhat;
import * as dotenv from "dotenv";
dotenv.config();
import { updateEnvFile } from "../multisig/utils.js";
Expand All @@ -18,19 +18,33 @@ async function main() {
console.log("Deploying TokenService Impl and Proxy...");

const tokenServiceImpl = await TokenService.deploy();
await tokenServiceImpl.deployed();
await tokenServiceImpl.deployTransaction.wait(3);
console.log("TokenService Impl Deployed to: ", tokenServiceImpl.address);
// Verification process
console.log("Verifying impl contract...");
await run("verify:verify", {
address: tokenServiceImpl.address,
constructorArguments: [], // Pass the constructor arguments here
contract: "contracts/main/tokenservice/TokenService.sol:TokenService"
});
updateEnvFile("TOKENSERVICE_IMPLEMENTATION_ADDRESS", tokenServiceImpl.address)

const ProxyContract = await ethers.getContractFactory("ProxyContract");
const initializeData = new ethers.utils.Interface(TokenService.interface.format()).encodeFunctionData("TokenService_init",
[bridgeAddress, deployerSigner.address, chainId, destChainId, process.env.BLACKLISTSERVICE_PROXY_ADDRESS]);

const tokenServiceProxy = await ProxyContract.deploy(tokenServiceImpl.address, initializeData);
await tokenServiceProxy.deployed();
await tokenServiceProxy.deployTransaction.wait(3);

updateEnvFile("TOKENSERVICE_PROXY_ADDRESS", tokenServiceProxy.address)
console.log("TokenService Proxy Deployed to: ", tokenServiceProxy.address);
console.log("Verifying proxy contract...");

await run("verify:verify", {
address: tokenServiceProxy.address,
constructorArguments: [tokenServiceImpl.address, initializeData], // Pass the constructor arguments here
contract: "contracts/proxies/Proxy.sol:ProxyContract"
});
updateEnvFile("TOKENSERVICE_PROXY_ADDRESS", tokenServiceProxy.address)
}
main()
.then(() => process.exit(0))
Expand Down
Loading

0 comments on commit c69feb9

Please sign in to comment.