Skip to content
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 .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
],
"code-complexity": ["error", 7],
"compiler-version": ["error", "^0.8.7"],
"compiler-version": ["error", "^0.8.0"],
"const-name-snakecase": "off",
"func-name-mixedcase": "off",
"constructor-syntax": "error",
Expand Down
5 changes: 5 additions & 0 deletions config/allbridge.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"addresses": {
"bsc": "0x3C4FA639c8D7E65c603145adaD8bD12F2358312f"
}
}
3 changes: 2 additions & 1 deletion deployments/bsc.diamond.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"0x050b1A40fBcAC0beccD9520D7363A33827283030",
"0x167D54C29A448fC0b9596EA530223330D608e22f",
"0x4dd8D62229BaF0B1ACcC3dE5c0637291323EF6b6",
"0x9556eC186526C028c3260737EA26A53EB51ce47B"
"0x9556eC186526C028c3260737EA26A53EB51ce47B",
"0x3dd2f184953A72EA00011D854C371639b95169d0"
]
}
5 changes: 3 additions & 2 deletions deployments/bsc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
"Receiver": "0xb15A66101ac2A6de589dAd1dCbbd7566DCCaB61D",
"TransferFacet": "0x9f50F4122B3d66397859C146e3489B4c0f66E17d",
"TransferWithBytesFacet": "0x9556eC186526C028c3260737EA26A53EB51ce47B",
"StargateV2Receiver": "0xDAd6723eb88bf4D20404687B1828e26d5D6eA498"
}
"StargateV2Receiver": "0xDAd6723eb88bf4D20404687B1828e26d5D6eA498",
"StellarFacet": "0x3dd2f184953A72EA00011D854C371639b95169d0"
}
52 changes: 52 additions & 0 deletions script/DeployStellarFacet.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;

import { DeployScriptBase } from "./utils/DeployScriptBase.sol";
import { stdJson } from "forge-std/Script.sol";
import { StellarFacet } from "rubic/Facets/StellarFacet.sol";

contract DeployScript is DeployScriptBase {
using stdJson for string;

constructor() DeployScriptBase("StellarFacet") {}

function run()
public
returns (StellarFacet deployed, bytes memory constructorArgs)
{
string memory path = string.concat(
vm.projectRoot(),
"/config/allbridge.json"
);
string memory json = vm.readFile(path);
address allBridgeCore = json.readAddress(
string.concat(".addresses.", network)
);

constructorArgs = abi.encode(allBridgeCore);

vm.startBroadcast(deployerPrivateKey);

if (isDeployed()) {
return (StellarFacet(payable(predicted)), constructorArgs);
}

if (networkSupportsCreate3(network)) {
deployed = StellarFacet(
payable(
factory.deploy(
salt,
bytes.concat(
type(StellarFacet).creationCode,
constructorArgs
)
)
)
);
} else {
deployed = new StellarFacet(allBridgeCore);
}

vm.stopBroadcast();
}
}
46 changes: 46 additions & 0 deletions script/UpdateStellarFacet.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;

import { UpdateScriptBase } from "./utils/UpdateScriptBase.sol";
import { stdJson } from "forge-std/StdJson.sol";
import { DiamondCutFacet, IDiamondCut } from "rubic/Facets/DiamondCutFacet.sol";
import { StellarFacet } from "rubic/Facets/StellarFacet.sol";

contract DeployScript is UpdateScriptBase {
using stdJson for string;

function run() public returns (address[] memory facets) {
string memory path = string.concat(
root,
"/deployments/",
network,
".",
fileSuffix,
"json"
);
string memory json = vm.readFile(path);
address facet = json.readAddress(".StellarFacet");

vm.startBroadcast(deployerPrivateKey);

// StellarFacet
if (loupe.facetFunctionSelectors(facet).length == 0) {
bytes4[] memory exclude;
cut.push(
IDiamondCut.FacetCut({
facetAddress: address(facet),
action: IDiamondCut.FacetCutAction.Add,
functionSelectors: getSelectors(
"StellarFacet",
exclude
)
})
);
cutter.diamondCut(cut, address(0), "");
}

facets = loupe.facetAddresses();

vm.stopBroadcast();
}
}
Loading
Loading