Skip to content

Commit

Permalink
feat: basic contract and deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
noyyyy committed Apr 13, 2024
1 parent 88610d8 commit f668546
Show file tree
Hide file tree
Showing 25 changed files with 8,452 additions and 76 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
2 changes: 2 additions & 0 deletions packages/contracts/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# directories
cache
coverage
artifacts
solcInputs
node_modules
out

Expand Down
Binary file removed packages/contracts/bun.lockb
Binary file not shown.
33 changes: 33 additions & 0 deletions packages/contracts/deploy/001_deploy_Troy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { keccak256, stringToBytes } from "viem";
import { getRouter } from "../utils/network";

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts } = hre;
const { deploy } = deployments;

const { deployer } = await getNamedAccounts();

const router = getRouter(await hre.getChainId());

await deploy("Troy", {
from: deployer,
args: [],
proxy: {
proxyContract: "ERC1967Proxy",
proxyArgs: ["{implementation}", "{data}"],
execute: {
init: {
methodName: "initialize",
args: [deployer, router],
},
},
checkProxyAdmin: false,
},
deterministicDeployment: keccak256(stringToBytes("Troy")),
log: true,
});
};
export default func;
func.tags = ["Troy"];
43 changes: 43 additions & 0 deletions packages/contracts/deploy/002_deploy_TrajonHorse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { keccak256, stringToBytes } from "viem";
import { getAggregator, getRouter } from "../utils/network";

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts } = hre;
const { deploy } = deployments;

const { deployer } = await getNamedAccounts();

const chainId = await hre.getChainId();
const router = getRouter(chainId);
const aggregator = getAggregator(chainId);

// manually set receiver
const receiver = "0x60688b3ba8816b4003b72f9b3927c3bb8e598005";

await deploy("TrajonHorse", {
from: deployer,
args: [],
proxy: {
proxyContract: "ERC1967Proxy",
proxyArgs: ["{implementation}", "{data}"],
execute: {
init: {
methodName: "initialize",
// chain selector
args: [deployer, router, aggregator, "16015286601757825753", receiver],
},
onUpgrade: {
methodName: "upgradeAndCall",
args: ["{implementation}", "0x"],
},
},
checkProxyAdmin: false,
},
deterministicDeployment: keccak256(stringToBytes("TrajonHorse")),
log: true,
});
};
export default func;
func.tags = ["TrajonHorse"];
1 change: 1 addition & 0 deletions packages/contracts/deployments/op_sepolia/.chainId
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
11155420
Loading

0 comments on commit f668546

Please sign in to comment.