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

feat: add relay deposit script, deploy new token gateway #266

Merged
merged 5 commits into from
Sep 3, 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
6 changes: 6 additions & 0 deletions .changeset/popular-rings-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@fuel-bridge/solidity-contracts': minor
'@fuel-bridge/test-utils': minor
---

Add relay deposit script
256 changes: 256 additions & 0 deletions packages/solidity-contracts/.openzeppelin/sepolia.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@
"address": "0x84C9ef458e85bA74F4DBF3a0B14075bE5341747B",
"txHash": "0xa27b677f1028c5a3f9ea3614de771e9265e13e0bf31e072c62f9bb8c6f3b64de",
"kind": "uups"
},
{
"address": "0x8B96Ed4aA36041B91a8510A1c644fC72177B5eA0",
"txHash": "0xb0a60d8cfd6fb250e76f35b0b8cf12ca628a2d4accf8a6c89dd69ffe37c85187",
"kind": "uups"
}
],
"impls": {
Expand Down Expand Up @@ -4246,6 +4251,257 @@
},
"namespaces": {}
}
},
"087131caba1a13a535ddf1d37c869d822f4bf79ac129e9168f14a4ba616b5e63": {
"address": "0x5F9eAEB3b7ec396F01617e9BAd787D0A6f93B7a3",
"txHash": "0xa3712d0734197da3afb819f937aec4670ac741855adf669fc8fff2ace8bfd797",
"layout": {
"solcVersion": "0.8.9",
"storage": [
{
"label": "_initialized",
"offset": 0,
"slot": "0",
"type": "t_uint8",
"contract": "Initializable",
"src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:63",
"retypedFrom": "bool"
},
{
"label": "_initializing",
"offset": 1,
"slot": "0",
"type": "t_bool",
"contract": "Initializable",
"src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:68"
},
{
"label": "_fuelMessagePortal",
"offset": 2,
"slot": "0",
"type": "t_contract(FuelMessagePortal)8014",
"contract": "FuelMessagesEnabled",
"src": "contracts/messaging/FuelMessagesEnabled.sol:21"
},
{
"label": "__gap",
"offset": 0,
"slot": "1",
"type": "t_array(t_uint256)49_storage",
"contract": "FuelMessagesEnabledUpgradeable",
"src": "contracts/messaging/FuelMessagesEnabledUpgradeable.sol:31"
},
{
"label": "__gap",
"offset": 0,
"slot": "50",
"type": "t_array(t_uint256)50_storage",
"contract": "ContextUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:40"
},
{
"label": "_paused",
"offset": 0,
"slot": "100",
"type": "t_bool",
"contract": "PausableUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:29"
},
{
"label": "__gap",
"offset": 0,
"slot": "101",
"type": "t_array(t_uint256)49_storage",
"contract": "PausableUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol:116"
},
{
"label": "__gap",
"offset": 0,
"slot": "150",
"type": "t_array(t_uint256)50_storage",
"contract": "ERC165Upgradeable",
"src": "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol:41"
},
{
"label": "_roles",
"offset": 0,
"slot": "200",
"type": "t_mapping(t_bytes32,t_struct(RoleData)23_storage)",
"contract": "AccessControlUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol:57"
},
{
"label": "__gap",
"offset": 0,
"slot": "201",
"type": "t_array(t_uint256)49_storage",
"contract": "AccessControlUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol:260"
},
{
"label": "__gap",
"offset": 0,
"slot": "250",
"type": "t_array(t_uint256)50_storage",
"contract": "ERC1967UpgradeUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol:169"
},
{
"label": "__gap",
"offset": 0,
"slot": "300",
"type": "t_array(t_uint256)50_storage",
"contract": "UUPSUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol:111"
},
{
"label": "whitelistRequired",
"offset": 0,
"slot": "350",
"type": "t_bool",
"contract": "FuelERC20GatewayV4",
"src": "contracts/messaging/gateway/FuelERC20Gateway/FuelERC20GatewayV4.sol:73"
},
{
"label": "assetIssuerId",
"offset": 0,
"slot": "351",
"type": "t_bytes32",
"contract": "FuelERC20GatewayV4",
"src": "contracts/messaging/gateway/FuelERC20Gateway/FuelERC20GatewayV4.sol:74"
},
{
"label": "_deposits",
"offset": 0,
"slot": "352",
"type": "t_mapping(t_address,t_uint256)",
"contract": "FuelERC20GatewayV4",
"src": "contracts/messaging/gateway/FuelERC20Gateway/FuelERC20GatewayV4.sol:76"
},
{
"label": "_depositLimits",
"offset": 0,
"slot": "353",
"type": "t_mapping(t_address,t_uint256)",
"contract": "FuelERC20GatewayV4",
"src": "contracts/messaging/gateway/FuelERC20Gateway/FuelERC20GatewayV4.sol:77"
},
{
"label": "_decimalsCache",
"offset": 0,
"slot": "354",
"type": "t_mapping(t_address,t_uint256)",
"contract": "FuelERC20GatewayV4",
"src": "contracts/messaging/gateway/FuelERC20Gateway/FuelERC20GatewayV4.sol:78"
},
{
"label": "rateLimitDuration",
"offset": 0,
"slot": "355",
"type": "t_mapping(t_address,t_uint256)",
"contract": "FuelERC20GatewayV4",
"src": "contracts/messaging/gateway/FuelERC20Gateway/FuelERC20GatewayV4.sol:81"
},
{
"label": "currentPeriodAmount",
"offset": 0,
"slot": "356",
"type": "t_mapping(t_address,t_uint256)",
"contract": "FuelERC20GatewayV4",
"src": "contracts/messaging/gateway/FuelERC20Gateway/FuelERC20GatewayV4.sol:84"
},
{
"label": "currentPeriodEnd",
"offset": 0,
"slot": "357",
"type": "t_mapping(t_address,t_uint256)",
"contract": "FuelERC20GatewayV4",
"src": "contracts/messaging/gateway/FuelERC20Gateway/FuelERC20GatewayV4.sol:87"
},
{
"label": "limitAmount",
"offset": 0,
"slot": "358",
"type": "t_mapping(t_address,t_uint256)",
"contract": "FuelERC20GatewayV4",
"src": "contracts/messaging/gateway/FuelERC20Gateway/FuelERC20GatewayV4.sol:90"
},
{
"label": "__gap",
"offset": 0,
"slot": "359",
"type": "t_array(t_uint256)49_storage",
"contract": "FuelERC20GatewayV4",
"src": "contracts/messaging/gateway/FuelERC20Gateway/FuelERC20GatewayV4.sol:440"
}
],
"types": {
"t_address": {
"label": "address",
"numberOfBytes": "20"
},
"t_array(t_uint256)49_storage": {
"label": "uint256[49]",
"numberOfBytes": "1568"
},
"t_array(t_uint256)50_storage": {
"label": "uint256[50]",
"numberOfBytes": "1600"
},
"t_bool": {
"label": "bool",
"numberOfBytes": "1"
},
"t_bytes32": {
"label": "bytes32",
"numberOfBytes": "32"
},
"t_contract(FuelMessagePortal)8014": {
"label": "contract FuelMessagePortal",
"numberOfBytes": "20"
},
"t_mapping(t_address,t_bool)": {
"label": "mapping(address => bool)",
"numberOfBytes": "32"
},
"t_mapping(t_address,t_uint256)": {
"label": "mapping(address => uint256)",
"numberOfBytes": "32"
},
"t_mapping(t_bytes32,t_struct(RoleData)23_storage)": {
"label": "mapping(bytes32 => struct AccessControlUpgradeable.RoleData)",
"numberOfBytes": "32"
},
"t_struct(RoleData)23_storage": {
"label": "struct AccessControlUpgradeable.RoleData",
"members": [
{
"label": "members",
"type": "t_mapping(t_address,t_bool)",
"offset": 0,
"slot": "0"
},
{
"label": "adminRole",
"type": "t_bytes32",
"offset": 0,
"slot": "1"
}
],
"numberOfBytes": "64"
},
"t_uint256": {
"label": "uint256",
"numberOfBytes": "32"
},
"t_uint8": {
"label": "uint8",
"numberOfBytes": "1"
}
},
"namespaces": {}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import type { HardhatRuntimeEnvironment } from 'hardhat/types';
import type { DeployFunction } from 'hardhat-deploy/dist/types';

import { FuelERC20GatewayV4__factory as FuelERC20Gateway } from '../../typechain';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {
ethers,
upgrades: { deployProxy, erc1967 },
deployments: { get, save },
} = hre;
const [deployer] = await ethers.getSigners();

const fuelMessagePortal = await get('FuelMessagePortal');

const contract = await deployProxy(
new FuelERC20Gateway(deployer),
[fuelMessagePortal.address],
{
initializer: 'initialize',
}
);
await contract.waitForDeployment();

const address = await contract.getAddress();
const implementation = await erc1967.getImplementationAddress(address);

console.log('Deployed FuelERC20GatewayV4 at', address);
await save('FuelERC20GatewayV4', {
address,
abi: [...FuelERC20Gateway.abi],
implementation,
});

return true;
};

func.tags = ['gateway_redeploy'];
func.id = 'gateway_redeploy';
export default func;
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import type { HardhatRuntimeEnvironment } from 'hardhat/types';
import type { DeployFunction } from 'hardhat-deploy/dist/types';

const ASSET_ISSUER_PROXY_ID =
'0x12f300d6d2b286dd5d290b709e0d3d73acc23c87ec10d349d4386b9524d740a1';

const ASSET_ISSUER_IMPL_ID =
'0x191f58253e324d85e66bdd20bf3d2d0ff55f0189e71387498783b07997c9a854';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { ethers, deployments } = hre;
const [deployer] = await ethers.getSigners();

await deployments.execute(
'FuelERC20GatewayV4',
{ log: true, from: deployer.address },
'setAssetIssuerId',
ASSET_ISSUER_PROXY_ID
);

await deployments.save('FuelL2BridgeId', {
address: ASSET_ISSUER_PROXY_ID,
abi: [],
implementation: ASSET_ISSUER_IMPL_ID,
});

return true;
};

func.tags = ['set_asset_issuer_redeploy'];
func.id = 'set_asset_issuer_redeploy';
export default func;
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@
"fuel_erc20_gateway_v4": 1723539697,
"set_asset_issuer": 1723539711,
"portal_upgrade_2": 1723815805,
"portal_set_chain_state": 1723815819
"portal_set_chain_state": 1723815819,
"gateway_redeploy": 1725036878,
"set_asset_issuer_redeploy": 1725036904
}
Loading
Loading