forked from DMDcoin/diamond-contracts-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request DMDcoin#234 from SurfingNerd/i231-phase-swith-for-…
…dao-2 I231 phase swith for dao
- Loading branch information
Showing
6 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// SPDX-License-Identifier: Apache 2.0 | ||
pragma solidity =0.8.25; | ||
|
||
interface IGovernancePot { | ||
function switchPhase() external; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-License-Identifier: Apache 2.0 | ||
pragma solidity =0.8.25; | ||
|
||
|
||
import { IGovernancePot } from "../interfaces/IGovernancePot.sol"; | ||
|
||
contract DaoMock is IGovernancePot { | ||
|
||
uint256 public phaseCounter; | ||
|
||
error SwitchPhaseReverted(); | ||
|
||
function switchPhase() external { | ||
phaseCounter += 1; | ||
|
||
// in order to also test the scenario that the DAO switchPhase() reverts, | ||
// and the blocks are still able to get closed, | ||
// we revert here. | ||
if (phaseCounter > 4) { | ||
revert SwitchPhaseReverted(); | ||
} | ||
} | ||
|
||
receive() external payable { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// SPDX-License-Identifier: Apache 2.0 | ||
pragma solidity =0.8.25; | ||
|
||
library TransferUtils { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { ethers, network, upgrades } from "hardhat"; | ||
|
||
|
||
export const GovernanceAddress = '0xDA0da0da0Da0Da0Da0DA00DA0da0da0DA0DA0dA0'; | ||
|
||
/// deploys the DAO Mock on the predefined address `GovernanceAddress`. | ||
export async function deployDao() { | ||
|
||
// we fake the deployment of a governance contract here. | ||
const DaoMockFactory = await ethers.getContractFactory("DaoMock"); | ||
let deployedDaoMock = await (await DaoMockFactory.deploy()).waitForDeployment(); | ||
let daoMockBytecode = await deployedDaoMock.getDeployedCode(); | ||
|
||
await network.provider.send("hardhat_setCode", [ | ||
GovernanceAddress, | ||
daoMockBytecode!, | ||
]); | ||
} |