Skip to content

Commit

Permalink
Update deployment scripts for new emc testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
newtmex committed Dec 23, 2024
1 parent cf2e921 commit e3878b2
Show file tree
Hide file tree
Showing 25 changed files with 16,544 additions and 164 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,25 @@ SmartHousing employs a native token, the SmartHousing Token (SHT), which serves

The SmartHousing ecosystem architecture integrates several key components: the `SmartHousing`, `ProjectFunding`, `Coinbase`, and `HousingProject` contracts. Here’s a summary of how these components interact within the ecosystem.

### 1. **SmartHousing Contract**: [Link to code](./packages/backend/contracts/main/)
### 1. **SmartHousing Contract**: [Link to code](./packages/backend/contracts/main/README.md)

The [SmartHousing](./packages/backend/contracts/main/) contract is the central hub of the SmartHousing ecosystem, facilitating real estate tokenization, fractional ownership, and investment opportunities. It manages user registrations, housing projects, staking mechanisms, and the distribution of rewards, making it a crucial component of the ecosystem's operations. Key features include initializing the ecosystem with essential addresses, managing user referrals, onboarding new projects, and facilitating staking and rewards for users.

Deployment: [0x5372A122f975F158414aE3737735d918F1CC477a](https://testnet.emcscan.com/address/0x5372A122f975F158414aE3737735d918F1CC477a#code)
Deployment: [0x9d6D17AbA70E87bFa269168a47a0aF4d68Cc00A4](https://sepolia.emcscan.com/address/0x9d6D17AbA70E87bFa269168a47a0aF4d68Cc00A4#code)

### 2. **ProjectFunding Contract**: [Link to code](./packages/backend/contracts/project-funding/)
### 2. **ProjectFunding Contract**: [Link to code](./packages/backend/contracts/project-funding/README.md)

The [ProjectFunding](./packages/backend/contracts/project-funding/) contract handles the deployment and funding of housing projects within the SmartHousing ecosystem. It manages the investment processes, distributes tokens to project investors, and integrates with the SmartHousing contract for project onboarding and token management. Key functions include initializing the first project, deploying additional projects, managing funding contributions, and distributing tokens upon successful funding.

Deployment: [0x98656048016a6b9f3566dac77371e56Ad4E0ca7c](https://testnet.emcscan.com/address/0x98656048016a6b9f3566dac77371e56Ad4E0ca7c#code)
Deployment: [0x6cdA93AAf0918B73c379C23a5393608b943eb0E5](https://sepolia.emcscan.com/address/0x6cdA93AAf0918B73c379C23a5393608b943eb0E5#code)

### 3. **Coinbase Contract**: [Link to code](./packages/backend/contracts/coinbase/)
### 3. **Coinbase Contract**: [Link to code](./packages/backend/contracts/coinbase/README.md)

The [Coinbase](./packages/backend/contracts/coinbase/) contract is responsible for initializing the SmartHousing ecosystem. It deploys the first housing project and configures the ProjectFunding contract with necessary parameters. This contract ensures that the initial project is set up correctly, paving the way for the deployment of additional projects.
The [Coinbase](./packages/backend/contracts/coinbase/) contract is an ERC20 compliant contract. It is the native and reward token of the SmartHousing ecosystem. It is responsible for initializing the SmartHousing ecosystem. It deploys the first housing project and configures the ProjectFunding contract with necessary parameters. This contract ensures that the initial project is set up correctly, paving the way for the deployment of additional projects.

Deployment: [0xCB538225d84769a0A1da8CB88396360966f33d19](https://testnet.emcscan.com/address/0xCB538225d84769a0A1da8CB88396360966f33d19#code)
Deployment: [0xf81F07aAC2C3F2586043cAf4fFe10f48AC7CfAAe](https://sepolia.emcscan.com/address/0xf81F07aAC2C3F2586043cAf4fFe10f48AC7CfAAe#code)

### 4. **HousingProject Contract**: [Link to code](./packages/backend/contracts/housing-project/)
### 4. **HousingProject Contract**: [Link to code](./packages/backend/contracts/housing-project/README.md)

The [HousingProject](./packages/backend/contracts/housing-project/) contract manages individual real estate projects within the SmartHousing ecosystem. It handles the deployment, funding, and tokenization of each project. This contract is essential for managing project-specific operations, such as accepting funding from users, minting tokens based on contributions, and integrating with the ProjectFunding contract.

Expand Down
2 changes: 1 addition & 1 deletion packages/backend/deploy/00_deploy_coinbase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const deployCoinbaseContract: DeployFunction = async function (hre: HardhatRunti
const { deployer } = await hre.getNamedAccounts();
const { deploy } = hre.deployments;

await deploy("Coinbase", { from: deployer, waitConfirmations: 3 });
await deploy("Coinbase", { from: deployer, log: true, skipIfAlreadyDeployed: false });
};

export default deployCoinbaseContract;
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/deploy/01_deploy_project_funding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const deployProjectFundingContract: DeployFunction = async function (hre: Hardha
NewLkSHT: await newLkSHTlib.getAddress(),
NewHousingProject: await newHousingProjectLib.getAddress(),
},
waitConfirmations: 3,
log: true,
});
};

Expand Down
10 changes: 6 additions & 4 deletions packages/backend/deploy/02_deploy_smart_housing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@ const deploySmartHousingContract: DeployFunction = async function (hre: HardhatR
const newHSTlib = await ethers.deployContract("NewHousingStakingToken");
await newHSTlib.waitForDeployment();

await deploy("SmartHousing", {
const { address: smartHousingAddress } = await deploy("SmartHousing", {
from: deployer,
args: [coinbaseAddress, projectFundingAddress],

libraries: { NewHousingStakingToken: await newHSTlib.getAddress() },
waitConfirmations: 3,
log: true,
});

const smartHousing = await hre.ethers.getContract<SmartHousing>("SmartHousing", deployer);
await coinbase.feedSmartHousing(await smartHousing.getAddress());
const feedSmartHousing = await coinbase.feedSmartHousing(smartHousingAddress);
if (hre.network.name != "localhost") {
await feedSmartHousing.wait(3);
}
};

export default deploySmartHousingContract;
Expand Down
20 changes: 14 additions & 6 deletions packages/backend/deploy/100_deploy_project_template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const deployHousingProject: DeployFunction = async function (hre: HardhatRuntime
const currentTimestamp = (await ethers.provider.getBlock(currentBlock))!.timestamp;

const threeWeeks = 3 * 7 * 24 * 3600;
await coinbase.startICO(
console.log("starting ICO");
const startICO = await coinbase.startICO(
"UloAku",
"AKU",
projectFunding,
Expand All @@ -27,30 +28,37 @@ const deployHousingProject: DeployFunction = async function (hre: HardhatRuntime
parseEther("2.005"),
currentTimestamp + threeWeeks,
);
if (hre.network.name != "localhost") {
await startICO.wait(3);
}
// TODO idealy, this is to be done after successful funding, but it will be teadious
// to simulate this in demo, hence we do this here with contract modificatino also
await projectFunding.addProjectToEcosystem(1n);
console.log("adding project to ecosystem");
const addProjectToEcosystem = await projectFunding.addProjectToEcosystem(1n);
if (hre.network.name != "localhost") {
await addProjectToEcosystem.wait(3);
}

// Done to have the abis in front end

await hre.deployments.deploy("HousingProject", {
from: deployer,
args: ["", "", ZeroAddress, ZeroAddress],
waitConfirmations: 3,
log: true,
});
await hre.deployments.deploy("HousingStakingToken", {
from: deployer,
waitConfirmations: 3,
log: true,
});
await hre.deployments.deploy("LkSHT", {
from: deployer,
args: ["", ""],
waitConfirmations: 3,
log: true,
});
await hre.deployments.deploy("HousingSFT", {
from: deployer,
args: ["", ""],
waitConfirmations: 3,
log: true,
});

if (hre.network.name == "localhost") {
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/deployments/emc/.chainId
Original file line number Diff line number Diff line change
@@ -1 +1 @@
99876
99879
38 changes: 19 additions & 19 deletions packages/backend/deployments/emc/Coinbase.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"address": "0xCB538225d84769a0A1da8CB88396360966f33d19",
"address": "0xf81F07aAC2C3F2586043cAf4fFe10f48AC7CfAAe",
"abi": [
{
"inputs": [],
Expand Down Expand Up @@ -422,48 +422,48 @@
"type": "function"
}
],
"transactionHash": "0x13617548bd078902ee31e8a50fef4344934b90704ce913267ef889187ec6fbee",
"transactionHash": "0x4a9588ec2de15a54130f39ba91fcfbc0afefd618e990a02f976c49bd6243e2fb",
"receipt": {
"to": null,
"from": "0x8D0739d9D0d49aFCF8d101416cD2759Bf8922013",
"contractAddress": "0xCB538225d84769a0A1da8CB88396360966f33d19",
"contractAddress": "0xf81F07aAC2C3F2586043cAf4fFe10f48AC7CfAAe",
"transactionIndex": 0,
"gasUsed": "1152429",
"logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000040000000000000000000000000000000000000000000000000000000000000000002000000000000000000008000000000001000000000000000000000000000000000000020000000000000000000800000000000000100000000010000000410000000000000000000000000000000000000000008000000000000000200000000200000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000800000000000000000000000000020000000000000000000000000000000000000020000000000000000000000000000",
"blockHash": "0xdf315005d883ba43869cc228ebea7a71a28562c0a9cfe09676ebccef6600fc7a",
"transactionHash": "0x13617548bd078902ee31e8a50fef4344934b90704ce913267ef889187ec6fbee",
"gasUsed": "1145573",
"logsBloom": "0x00000000000000000000000080000000000000000000000000800000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000001000000000000000000000000000020000000420000000000000000000800000000000000100000000010000000400000000000000001000000000000000000000000000000000000000000000000000200000000000000000000000000040000000000000000000000000000000000000002000000000000000000000000000000200000000000000000000020000000000000000000000000000000000000000000000000000000000000000000",
"blockHash": "0x878f8520bd84cb3cfe57656789a5fa55b048dc85aabc3d23722a099cc7f7e093",
"transactionHash": "0x4a9588ec2de15a54130f39ba91fcfbc0afefd618e990a02f976c49bd6243e2fb",
"logs": [
{
"transactionIndex": 0,
"blockNumber": 3142330,
"transactionHash": "0x13617548bd078902ee31e8a50fef4344934b90704ce913267ef889187ec6fbee",
"address": "0xCB538225d84769a0A1da8CB88396360966f33d19",
"blockNumber": 81179,
"transactionHash": "0x4a9588ec2de15a54130f39ba91fcfbc0afefd618e990a02f976c49bd6243e2fb",
"address": "0xf81F07aAC2C3F2586043cAf4fFe10f48AC7CfAAe",
"topics": [
"0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000008d0739d9d0d49afcf8d101416cd2759bf8922013"
],
"data": "0x",
"logIndex": 0,
"blockHash": "0xdf315005d883ba43869cc228ebea7a71a28562c0a9cfe09676ebccef6600fc7a"
"blockHash": "0x878f8520bd84cb3cfe57656789a5fa55b048dc85aabc3d23722a099cc7f7e093"
},
{
"transactionIndex": 0,
"blockNumber": 3142330,
"transactionHash": "0x13617548bd078902ee31e8a50fef4344934b90704ce913267ef889187ec6fbee",
"address": "0xCB538225d84769a0A1da8CB88396360966f33d19",
"transactionIndex": 1,
"blockNumber": 81179,
"transactionHash": "0x4a9588ec2de15a54130f39ba91fcfbc0afefd618e990a02f976c49bd6243e2fb",
"address": "0xf81F07aAC2C3F2586043cAf4fFe10f48AC7CfAAe",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x000000000000000000000000cb538225d84769a0a1da8cb88396360966f33d19"
"0x000000000000000000000000f81f07aac2c3f2586043caf4ffe10f48ac7cfaae"
],
"data": "0x000000000000000000000000000000000000000000115eec47f6cf7e35000000",
"logIndex": 1,
"blockHash": "0xdf315005d883ba43869cc228ebea7a71a28562c0a9cfe09676ebccef6600fc7a"
"blockHash": "0x878f8520bd84cb3cfe57656789a5fa55b048dc85aabc3d23722a099cc7f7e093"
}
],
"blockNumber": 3142330,
"cumulativeGasUsed": "1152429",
"blockNumber": 81179,
"cumulativeGasUsed": "1145573",
"status": 1,
"byzantium": true
},
Expand Down
Loading

0 comments on commit e3878b2

Please sign in to comment.