From 88d9b0d2054e96e5283b61202bb042b29f5a8d13 Mon Sep 17 00:00:00 2001 From: herbig Date: Wed, 15 Feb 2023 19:14:30 -0500 Subject: [PATCH] Fix tests --- contracts/ConnectFour/ConnectFour.sol | 4 +- package-lock.json | 2 +- package.json | 4 +- test/ConnectFour.test.ts | 384 ++++++++++---------- typechain/ConnectFour.ts | 72 +++- typechain/factories/ConnectFour__factory.ts | 36 +- 6 files changed, 302 insertions(+), 200 deletions(-) diff --git a/contracts/ConnectFour/ConnectFour.sol b/contracts/ConnectFour/ConnectFour.sol index 0ff4002..7a0f309 100644 --- a/contracts/ConnectFour/ConnectFour.sol +++ b/contracts/ConnectFour/ConnectFour.sol @@ -91,7 +91,7 @@ contract ConnectFour { * @param _gameId id of game * @param column selected column for move */ - function makeMove( + function makeMoveById( uint8 _gameId, uint8 column ) public gameOver(_gameId) validColumn(column) { @@ -143,7 +143,7 @@ contract ConnectFour { function makeMove(uint8 _column) external { uint id = getGameIdFromAddress[msg.sender]; require(id != 0, "Not currently playing."); - makeMove(uint8(id), _column); + makeMoveById(uint8(id), _column); } function setGameIdFromAddress(Game memory _game, uint _gameId) private { diff --git a/package-lock.json b/package-lock.json index 8bb71b3..39448db 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,7 +28,7 @@ "chai": "^4.3.7", "dotenv": "^16.0.3", "ethers": "^5.7.1", - "hardhat": "^2.12.4", + "hardhat": "^2.12.7", "hardhat-deploy": "^0.11.22", "hardhat-deploy-ethers": "0.3.0-beta.13", "hardhat-gas-reporter": "^1.0.9", diff --git a/package.json b/package.json index 7f224d6..0f8657e 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "chai": "^4.3.7", "dotenv": "^16.0.3", "ethers": "^5.7.1", - "hardhat": "^2.12.4", + "hardhat": "^2.12.7", "hardhat-deploy": "^0.11.22", "hardhat-deploy-ethers": "0.3.0-beta.13", "hardhat-gas-reporter": "^1.0.9", @@ -55,4 +55,4 @@ "dependencies": { "@openzeppelin/contracts-upgradeable": "^4.8.0" } -} \ No newline at end of file +} diff --git a/test/ConnectFour.test.ts b/test/ConnectFour.test.ts index e71ece3..ac8cc57 100644 --- a/test/ConnectFour.test.ts +++ b/test/ConnectFour.test.ts @@ -37,326 +37,326 @@ describe("ConnectFour", () => { }) it("Should play first move", async () => { - await expect(gameOneContractSignerTwo.makeMove(connectFourGameOneId, 0)) + await expect(gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 0)) .to.emit(gameOneContractSignerTwo, "TurnTaken") .withArgs(connectFourGameOneId, account2.address, 0) }) it("Should end with horizontal win; team two; short length game", async () => { - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 0) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 0) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 0) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 0) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 1) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 1) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 1) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 1) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 2) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 5) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 2) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 5) - await expect(gameOneContractSignerTwo.makeMove(connectFourGameOneId, 3)) + await expect(gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 3)) .to.emit(gameOneContractSignerTwo, "GameFinished") .withArgs(connectFourGameOneId, account2.address) }) it("Should end with horizontal win; team two; testing failure case", async () => { - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 5) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 5) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 5) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 5) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 4) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 1) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 4) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 1) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 2) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 0) - await expect(gameOneContractSignerTwo.makeMove(connectFourGameOneId, 3)) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 2) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 0) + await expect(gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 3)) .to.emit(gameOneContractSignerTwo, "GameFinished") .withArgs(connectFourGameOneId, account2.address) }) it("Should end with horizontal win; team two; testing failure case; new column", async () => { - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 6) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 0) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 6) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 0) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 5) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 0) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 5) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 0) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 3) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 0) - await expect(gameOneContractSignerTwo.makeMove(connectFourGameOneId, 4)) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 3) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 0) + await expect(gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 4)) .to.emit(gameOneContractSignerTwo, "GameFinished") .withArgs(connectFourGameOneId, account2.address) }) it("Should end with horizontal win; team two; long length game", async () => { - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 0) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 0) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 0) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 0) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 1) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 1) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 1) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 1) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 2) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 2) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 2) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 2) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 4) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 3) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 4) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 3) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 3) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 4) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 3) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 4) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 5) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 5) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 5) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 5) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 0) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 0) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 0) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 0) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 1) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 1) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 1) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 1) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 2) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 2) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 2) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 2) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 4) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 3) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 3) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 4) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 4) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 3) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 3) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 4) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 5) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 5) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 5) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 5) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 0) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 0) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 0) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 0) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 1) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 1) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 1) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 1) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 2) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 2) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 2) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 2) - await expect(gameOneContractSignerTwo.makeMove(connectFourGameOneId, 3)) + await expect(gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 3)) .to.emit(gameOneContractSignerTwo, "GameFinished") .withArgs(connectFourGameOneId, account2.address) }) it("Should end with horizontal win; team two; long length game; new column", async () => { - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 1) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 1) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 1) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 1) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 2) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 2) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 2) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 2) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 3) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 3) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 3) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 3) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 5) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 4) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 5) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 4) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 4) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 5) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 4) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 5) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 6) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 6) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 6) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 6) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 1) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 1) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 1) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 1) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 2) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 2) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 2) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 2) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 3) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 3) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 3) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 3) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 5) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 4) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 4) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 5) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 5) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 4) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 4) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 5) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 6) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 6) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 6) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 6) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 1) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 1) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 1) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 1) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 2) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 2) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 2) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 2) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 3) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 3) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 3) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 3) - await expect(gameOneContractSignerTwo.makeMove(connectFourGameOneId, 4)) + await expect(gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 4)) .to.emit(gameOneContractSignerTwo, "GameFinished") .withArgs(connectFourGameOneId, account2.address) }) it("Should end with veritical win; team one; med length game", async () => { - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 0) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 1) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 0) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 1) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 2) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 3) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 2) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 3) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 5) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 4) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 5) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 4) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 0) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 1) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 0) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 1) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 2) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 3) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 2) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 3) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 5) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 4) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 5) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 4) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 1) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 0) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 1) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 0) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 3) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 2) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 3) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 2) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 5) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 4) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 5) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 4) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 2) - await expect(gameOneContractSignerOne.makeMove(connectFourGameOneId, 4)) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 2) + await expect(gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 4)) .to.emit(gameOneContractSignerOne, "GameFinished") .withArgs(connectFourGameOneId, account1.address) }) it("Should end with veritical win; team one; med length game: new column", async () => { - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 1) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 2) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 1) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 2) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 3) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 4) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 3) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 4) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 6) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 5) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 6) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 5) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 1) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 2) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 1) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 2) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 3) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 4) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 3) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 4) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 6) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 5) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 6) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 5) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 2) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 1) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 2) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 1) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 4) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 3) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 4) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 3) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 6) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 5) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 6) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 5) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 3) - await expect(gameOneContractSignerOne.makeMove(connectFourGameOneId, 5)) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 3) + await expect(gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 5)) .to.emit(gameOneContractSignerOne, "GameFinished") .withArgs(connectFourGameOneId, account1.address) }) it("Should end with forward angle win; team two; short length game", async () => { - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 1) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 2) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 1) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 2) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 2) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 3) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 2) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 3) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 3) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 4) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 3) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 4) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 3) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 0) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 3) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 0) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 4) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 4) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 4) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 4) - await expect(gameOneContractSignerTwo.makeMove(connectFourGameOneId, 4)) + await expect(gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 4)) .to.emit(gameOneContractSignerTwo, "GameFinished") .withArgs(connectFourGameOneId, account2.address) }) it("Should end with forward angle win; team two; short length game; new column", async () => { - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 3) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 4) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 3) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 4) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 4) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 5) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 4) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 5) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 5) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 6) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 5) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 6) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 5) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 2) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 5) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 2) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 6) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 6) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 6) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 6) - await expect(gameOneContractSignerTwo.makeMove(connectFourGameOneId, 6)) + await expect(gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 6)) .to.emit(gameOneContractSignerTwo, "GameFinished") .withArgs(connectFourGameOneId, account2.address) }) it("Should end with backward angle win; team one; short length game", async () => { - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 3) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 4) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 3) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 4) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 2) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 3) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 2) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 3) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 1) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 2) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 1) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 2) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 4) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 2) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 4) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 2) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 1) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 1) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 1) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 1) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 3) - await expect(gameOneContractSignerOne.makeMove(connectFourGameOneId, 1)) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 3) + await expect(gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 1)) .to.emit(gameOneContractSignerOne, "GameFinished") .withArgs(connectFourGameOneId, account1.address) }) it("Should end with backward angle win; team one; short length game", async () => { - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 5) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 6) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 5) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 6) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 4) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 5) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 4) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 5) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 3) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 4) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 3) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 4) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 5) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 4) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 5) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 4) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 3) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 3) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 3) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 3) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 5) - await expect(gameOneContractSignerOne.makeMove(connectFourGameOneId, 3)) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 5) + await expect(gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 3)) .to.emit(gameOneContractSignerOne, "GameFinished") .withArgs(connectFourGameOneId, account1.address) }) it("Should end with backward angle win; team one; beta testing failure", async () => { - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 0) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 3) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 0) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 3) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 1) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 1) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 1) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 1) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 2) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 0) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 2) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 0) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 0) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 1) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 0) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 1) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 3) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 2) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 3) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 2) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 5) - await expect(gameOneContractSignerOne.makeMove(connectFourGameOneId, 0)) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 5) + await expect(gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 0)) .to.emit(gameOneContractSignerOne, "GameFinished") .withArgs(connectFourGameOneId, account1.address) }) @@ -369,28 +369,28 @@ describe("ConnectFour", () => { }) it("Should prevent team one from going first", async () => { - await expect(gameOneContractSignerOne.makeMove(connectFourGameOneId, 1)) + await expect(gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 1)) .to.revertedWithCustomError(gameOneContractSignerOne, "NotYourTurn") }) it("Should prevent random address from playing", async () => { - await expect(gameOneContractSignerThree.makeMove(connectFourGameOneId, 1)) + await expect(gameOneContractSignerThree.makeMoveById(connectFourGameOneId, 1)) .to.revertedWithCustomError(gameOneContractSignerThree, "NotYourTurn") }) it("Should revert if invalid column", async () => { - await expect(gameOneContractSignerTwo.makeMove(connectFourGameOneId, 7)) + await expect(gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 7)) .to.revertedWithCustomError(gameOneContractSignerTwo, "InvalidSelection") }) it("Should revert if row is exceeded", async () => { - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 0) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 0) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 0) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 0) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 0) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 0) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 0) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 0) - await gameOneContractSignerTwo.makeMove(connectFourGameOneId, 0) - await gameOneContractSignerOne.makeMove(connectFourGameOneId, 0) - await expect(gameOneContractSignerTwo.makeMove(connectFourGameOneId, 0)) + await gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 0) + await gameOneContractSignerOne.makeMoveById(connectFourGameOneId, 0) + await expect(gameOneContractSignerTwo.makeMoveById(connectFourGameOneId, 0)) .to.revertedWithCustomError(gameOneContractSignerTwo, "InvalidSelection") }) }) diff --git a/typechain/ConnectFour.ts b/typechain/ConnectFour.ts index 74a3c5c..090a02e 100644 --- a/typechain/ConnectFour.ts +++ b/typechain/ConnectFour.ts @@ -33,7 +33,9 @@ export interface ConnectFourInterface extends utils.Interface { "gameId()": FunctionFragment; "getGame(uint256)": FunctionFragment; "getGameBoard(uint8)": FunctionFragment; - "makeMove(uint8,uint8)": FunctionFragment; + "getGameIdFromAddress(address)": FunctionFragment; + "makeMove(uint8)": FunctionFragment; + "makeMoveById(uint8,uint8)": FunctionFragment; }; getFunction( @@ -42,7 +44,9 @@ export interface ConnectFourInterface extends utils.Interface { | "gameId" | "getGame" | "getGameBoard" + | "getGameIdFromAddress" | "makeMove" + | "makeMoveById" ): FunctionFragment; encodeFunctionData( @@ -58,8 +62,16 @@ export interface ConnectFourInterface extends utils.Interface { functionFragment: "getGameBoard", values: [PromiseOrValue] ): string; + encodeFunctionData( + functionFragment: "getGameIdFromAddress", + values: [PromiseOrValue] + ): string; encodeFunctionData( functionFragment: "makeMove", + values: [PromiseOrValue] + ): string; + encodeFunctionData( + functionFragment: "makeMoveById", values: [PromiseOrValue, PromiseOrValue] ): string; @@ -70,7 +82,15 @@ export interface ConnectFourInterface extends utils.Interface { functionFragment: "getGameBoard", data: BytesLike ): Result; + decodeFunctionResult( + functionFragment: "getGameIdFromAddress", + data: BytesLike + ): Result; decodeFunctionResult(functionFragment: "makeMove", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "makeMoveById", + data: BytesLike + ): Result; events: { "GameCreated(uint256,address,address)": EventFragment; @@ -169,7 +189,17 @@ export interface ConnectFour extends BaseContract { overrides?: CallOverrides ): Promise<[number[][]]>; + getGameIdFromAddress( + arg0: PromiseOrValue, + overrides?: CallOverrides + ): Promise<[BigNumber]>; + makeMove( + _column: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + makeMoveById( _gameId: PromiseOrValue, column: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } @@ -200,7 +230,17 @@ export interface ConnectFour extends BaseContract { overrides?: CallOverrides ): Promise; + getGameIdFromAddress( + arg0: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + makeMove( + _column: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + makeMoveById( _gameId: PromiseOrValue, column: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } @@ -231,7 +271,17 @@ export interface ConnectFour extends BaseContract { overrides?: CallOverrides ): Promise; + getGameIdFromAddress( + arg0: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + makeMove( + _column: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + + makeMoveById( _gameId: PromiseOrValue, column: PromiseOrValue, overrides?: CallOverrides @@ -286,7 +336,17 @@ export interface ConnectFour extends BaseContract { overrides?: CallOverrides ): Promise; + getGameIdFromAddress( + arg0: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + makeMove( + _column: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + makeMoveById( _gameId: PromiseOrValue, column: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } @@ -311,7 +371,17 @@ export interface ConnectFour extends BaseContract { overrides?: CallOverrides ): Promise; + getGameIdFromAddress( + arg0: PromiseOrValue, + overrides?: CallOverrides + ): Promise; + makeMove( + _column: PromiseOrValue, + overrides?: Overrides & { from?: PromiseOrValue } + ): Promise; + + makeMoveById( _gameId: PromiseOrValue, column: PromiseOrValue, overrides?: Overrides & { from?: PromiseOrValue } diff --git a/typechain/factories/ConnectFour__factory.ts b/typechain/factories/ConnectFour__factory.ts index f9c2964..7704dd9 100644 --- a/typechain/factories/ConnectFour__factory.ts +++ b/typechain/factories/ConnectFour__factory.ts @@ -170,6 +170,38 @@ const _abi = [ stateMutability: "view", type: "function", }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "getGameIdFromAddress", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint8", + name: "_column", + type: "uint8", + }, + ], + name: "makeMove", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, { inputs: [ { @@ -183,7 +215,7 @@ const _abi = [ type: "uint8", }, ], - name: "makeMove", + name: "makeMoveById", outputs: [], stateMutability: "nonpayable", type: "function", @@ -191,7 +223,7 @@ const _abi = [ ] as const; const _bytecode = - "0x608060405234801561001057600080fd5b50610ded806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80635e24b0f11461005c57806372fb9703146100715780639b33b42914610084578063a2f77bcc146100ad578063d7c81b551461012b575b600080fd5b61006f61006a366004610c09565b610142565b005b61006f61007f366004610c3c565b610424565b610097610092366004610c6c565b61055a565b6040516100a49190610c87565b60405180910390f35b6100f86100bb366004610ce5565b60016020819052600091825260409091208054918101546002909101546001600160a01b039283169291821691811690600160a01b900460ff1684565b604080516001600160a01b0395861681529385166020850152919093169082015260ff90911660608201526080016100a4565b61013460005481565b6040519081526020016100a4565b60ff82166000818152600160205260409020600201546001600160a01b03161561017f5760405163df469ccb60e01b815260040160405180910390fd5b8160068160ff1611156101a557604051631efccef760e11b815260040160405180910390fd5b60ff84166000908152600160208190526040822060028101549092918291600160a01b900416156101d75760016101da565b60025b6002840154909150600160a01b9004600116156102015782546001600160a01b0316610210565b60018301546001600160a01b03165b6001600160a01b0316336001600160a01b03161461024157604051631cc191eb60e31b815260040160405180910390fd5b60005b60078160ff1610156102ec5760058160ff16111561027557604051631efccef760e11b815260040160405180910390fd5b6000846003018260ff166006811061028f5761028f610cfe565b018860ff16600781106102a4576102a4610cfe565b602081049091015460ff601f9092166101000a900416905060008190036102d957816102cf81610d2a565b92509350506102ec565b50806102e481610d2a565b915050610244565b5080836003018360ff166006811061030657610306610cfe565b018760ff166007811061031b5761031b610cfe565b60208104909101805460ff938416601f9093166101000a9283029284021916919091179055600284018054600160a01b900490911690601461035c83610d2a565b82546101009290920a60ff818102199093169183160217909155604080513381528983166020820152918a1692507fa6f41f711ea470b4b237d1b3e43b201e53517677308ae067a273fb1948ddbf0c910160405180910390a26103c1878784846105f9565b1561041b576002830180546001600160a01b031916339081179091556040805160ff8a16815260208101929092527fb7f35e624e036288272fbf3342c09219261ff29fdddd826989b289134e9ae535910160405180910390a15b50505050505050565b806001600160a01b038116330361043a57600080fd5b610442610aa7565b6040805160a0810182523381526001600160a01b038581166020808401918252600084860181815260608601828152608087018981528354845260019485905297909220865181549087166001600160a01b03199182161782559451938101805494871694909516939093179093559151600282018054935160ff16600160a01b026001600160a81b03199094169190941617919091179091559151909182916104f29060038301906006610ad4565b5050600054604080519182523360208301526001600160a01b038716908201527f8946648bc1dbc670d3f07e2c4de91731227b6d4ccc53b8ab1e951e84d960577e915060600160405180910390a160008054908061054f83610d49565b919050555050505050565b610562610aa7565b60ff8216600090815260016020526040808220815160c081019092529091600390910190600690835b828210156105ee576040805160e08101918290529085840190600790826000855b825461010083900a900460ff168152602060019283018181049485019490930390920291018084116105ac57905050505050508152602001906001019061058b565b505050509050919050565b60008061060886868686610699565b90508060040361061c576001915050610691565b600061062a87878787610759565b90508060040361063f57600192505050610691565b600061064d88888888610804565b9050806004036106635760019350505050610691565b60006106718989898961090a565b905080600403610688576001945050505050610691565b60009450505050505b949350505050565b60006001816106a88683610d62565b90505b60078160ff1610156106f1576106c387868387610a39565b156106da57816106d281610d49565b9250506106df565b6106f1565b806106e981610d2a565b9150506106ab565b5060ff851615610750576000610708600187610d81565b90505b61071787868387610a39565b1561072e578161072681610d49565b925050610733565b61074e565b60ff81161561074e578061074681610d9a565b91505061070b565b505b95945050505050565b60006001816107688583610d62565b90505b60068160ff1610156107b15761078387828887610a39565b1561079a578161079281610d49565b92505061079f565b6107b1565b806107a981610d2a565b91505061076b565b5060ff8416156107505760006107c8600186610d81565b90505b6107d787828887610a39565b1561072e57816107e681610d49565b92505060ff81161561074e57806107fc81610d9a565b9150506107cb565b60006001816108138583610d62565b90505b610821856006610d81565b60ff168160ff1610156108685761083a87828387610a39565b15610851578161084981610d49565b925050610856565b610868565b8061086081610d2a565b915050610816565b5060ff84161580159061087d575060ff851615155b1561075057600061088f600186610d81565b9050600061089e600188610d81565b90505b6108ad88838388610a39565b156108c457826108bc81610d49565b9350506108c9565b6108fe565b60ff821615806108da575060ff8116155b6108fe57816108e881610d9a565b92505080806108f690610d9a565b9150506108a1565b50509050949350505050565b6000600160ff8416156109a5576000610924600186610d81565b90506000610933876001610d62565b90505b60078160ff1610156109a25761094e88838388610a39565b15610965578261095d81610d49565b93505061096a565b6109a2565b60ff8216158061097e575060068160ff1610155b6109a2578161098c81610d9a565b925050808061099a90610d2a565b915050610936565b50505b60ff8516156107505760006109bb856001610d62565b905060006109ca600188610d81565b90505b60068260ff161080156109de575060015b156108fe576109ef88838388610a39565b156108c457826109fe81610d49565b93505060068260ff16101580610a15575060ff8116155b6108fe5781610a2381610d2a565b9250508080610a3190610d9a565b9150506109cd565b600080600160008760ff16815260200190815260200160002060030190508260ff16818660ff1660068110610a7057610a70610cfe565b018560ff1660078110610a8557610a85610cfe565b602081049091015460ff601f9092166101000a90041614915050949350505050565b6040518060c001604052806006905b610abe610b1e565b815260200190600190039081610ab65790505090565b8260068101928215610b0e579160200282015b82811115610b0e578251610afe9083906007610b3c565b5091602001919060010190610ae7565b50610b1a929150610bcb565b5090565b6040518060e001604052806007906020820280368337509192915050565b600183019183908215610bbf5791602002820160005b83821115610b9057835183826101000a81548160ff021916908360ff1602179055509260200192600101602081600001049283019260010302610b52565b8015610bbd5782816101000a81549060ff0219169055600101602081600001049283019260010302610b90565b505b50610b1a929150610bdf565b80821115610b1a5760008155600101610bcb565b80821115610b1a5760008155600101610bcb565b803560ff81168114610c0457600080fd5b919050565b60008060408385031215610c1c57600080fd5b610c2583610bf3565b9150610c3360208401610bf3565b90509250929050565b600060208284031215610c4e57600080fd5b81356001600160a01b0381168114610c6557600080fd5b9392505050565b600060208284031215610c7e57600080fd5b610c6582610bf3565b610540810181836000805b6006811015610cdb57825184835b6007811015610cc257825160ff16825260209283019290910190600101610ca0565b50505060e0939093019260209290920191600101610c92565b5050505092915050565b600060208284031215610cf757600080fd5b5035919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060ff821660ff8103610d4057610d40610d14565b60010192915050565b600060018201610d5b57610d5b610d14565b5060010190565b60ff8181168382160190811115610d7b57610d7b610d14565b92915050565b60ff8281168282160390811115610d7b57610d7b610d14565b600060ff821680610dad57610dad610d14565b600019019291505056fea2646970667358221220c6bed02514d044430679bd96da17f777697d9494240fe69dc1c4bc10a2f354ee64736f6c63430008110033"; + "0x608060405234801561001057600080fd5b50611079806100206000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c806372fb97031161005b57806372fb9703146100dd5780639b33b429146100f0578063a2f77bcc14610110578063d7c81b551461018e57600080fd5b806310572ee014610082578063650271d2146100b55780636a37129f146100ca575b600080fd5b6100a2610090366004610e7f565b60026020526000908152604090205481565b6040519081526020015b60405180910390f35b6100c86100c3366004610ec5565b610197565b005b6100c86100d8366004610ee0565b610203565b6100c86100eb366004610e7f565b6105d7565b6101036100fe366004610ec5565b6107e6565b6040516100ac9190610f13565b61015b61011e366004610f71565b60016020819052600091825260409091208054918101546002909101546001600160a01b039283169291821691811690600160a01b900460ff1684565b604080516001600160a01b0395861681529385166020850152919093169082015260ff90911660608201526080016100ac565b6100a260005481565b33600090815260026020526040812054908190036101f55760405162461bcd60e51b81526020600482015260166024820152752737ba1031bab93932b73a363c90383630bcb4b7339760511b60448201526064015b60405180910390fd5b6101ff8183610203565b5050565b60ff82166000818152600160205260409020600201546001600160a01b0316156102405760405163df469ccb60e01b815260040160405180910390fd5b8160068160ff16111561026657604051631efccef760e11b815260040160405180910390fd5b60ff84166000908152600160208190526040822060028101549092918291600160a01b9004161561029857600161029b565b60025b6002840154909150600160a01b9004600116156102c25782546001600160a01b03166102d1565b60018301546001600160a01b03165b6001600160a01b0316336001600160a01b03161461030257604051631cc191eb60e31b815260040160405180910390fd5b60005b60078160ff1610156103ad5760058160ff16111561033657604051631efccef760e11b815260040160405180910390fd5b6000846003018260ff166006811061035057610350610f8a565b018860ff166007811061036557610365610f8a565b602081049091015460ff601f9092166101000a9004169050600081900361039a578161039081610fb6565b92509350506103ad565b50806103a581610fb6565b915050610305565b5080836003018360ff16600681106103c7576103c7610f8a565b018760ff16600781106103dc576103dc610f8a565b60208104909101805460ff938416601f9093166101000a9283029284021916919091179055600284018054600160a01b900490911690601461041d83610fb6565b82546101009290920a60ff818102199093169183160217909155604080513381528983166020820152918a1692507fa6f41f711ea470b4b237d1b3e43b201e53517677308ae067a273fb1948ddbf0c910160405180910390a261048287878484610885565b156105ce57600283018054336001600160a01b03199091168117918290556040805160a08101825286546001600160a01b039081168252600188015416602082015280820192909252600160a01b90920460ff166060820152815160c0810190925261059291859060808301906003830160066000835b8282101561055c576040805160e08101918290529085840190600790826000855b825461010083900a900460ff1681526020600192830181810494850194909303909202910180841161051a5790505050505050815260200190600101906104f9565b5050509152505080516001600160a01b039081166000908152600260209081526040808320839055930151909116815290812055565b6040805160ff891681523360208201527fb7f35e624e036288272fbf3342c09219261ff29fdddd826989b289134e9ae535910160405180910390a15b50505050505050565b806001600160a01b03811633036105ed57600080fd5b336000908152600260205260409020541561063d5760405162461bcd60e51b815260206004820152601060248201526f20b63932b0b23c90383630bcb4b7339760811b60448201526064016101ec565b6001600160a01b038216600090815260026020526040902054156106a35760405162461bcd60e51b815260206004820152601c60248201527f4f70706f6e656e7420697320616c726561647920706c6179696e672e0000000060448201526064016101ec565b6106ab610d33565b6040805160a0810182523381526001600160a01b038581166020808401918252600084860181815260608601828152608087018981528354845260019485905297909220865181549087166001600160a01b03199182161782559451938101805494871694909516939093179093559151600282018054935160ff16600160a01b026001600160a81b031990941691909416179190911790915591519091829161075b9060038301906006610d60565b50506000805483516001600160a01b0390811683526002602090815260408085208490558187015183168552938490208390558351928352339083015287168183015290517f8946648bc1dbc670d3f07e2c4de91731227b6d4ccc53b8ab1e951e84d960577e92509081900360600190a16000805490806107db83610fd5565b919050555050505050565b6107ee610d33565b60ff8216600090815260016020526040808220815160c081019092529091600390910190600690835b8282101561087a576040805160e08101918290529085840190600790826000855b825461010083900a900460ff16815260206001928301818104948501949093039092029101808411610838579050505050505081526020019060010190610817565b505050509050919050565b60008061089486868686610925565b9050806004036108a857600191505061091d565b60006108b6878787876109e5565b9050806004036108cb5760019250505061091d565b60006108d988888888610a90565b9050806004036108ef576001935050505061091d565b60006108fd89898989610b96565b90508060040361091457600194505050505061091d565b60009450505050505b949350505050565b60006001816109348683610fee565b90505b60078160ff16101561097d5761094f87868387610cc5565b15610966578161095e81610fd5565b92505061096b565b61097d565b8061097581610fb6565b915050610937565b5060ff8516156109dc57600061099460018761100d565b90505b6109a387868387610cc5565b156109ba57816109b281610fd5565b9250506109bf565b6109da565b60ff8116156109da57806109d281611026565b915050610997565b505b95945050505050565b60006001816109f48583610fee565b90505b60068160ff161015610a3d57610a0f87828887610cc5565b15610a265781610a1e81610fd5565b925050610a2b565b610a3d565b80610a3581610fb6565b9150506109f7565b5060ff8416156109dc576000610a5460018661100d565b90505b610a6387828887610cc5565b156109ba5781610a7281610fd5565b92505060ff8116156109da5780610a8881611026565b915050610a57565b6000600181610a9f8583610fee565b90505b610aad85600661100d565b60ff168160ff161015610af457610ac687828387610cc5565b15610add5781610ad581610fd5565b925050610ae2565b610af4565b80610aec81610fb6565b915050610aa2565b5060ff841615801590610b09575060ff851615155b156109dc576000610b1b60018661100d565b90506000610b2a60018861100d565b90505b610b3988838388610cc5565b15610b505782610b4881610fd5565b935050610b55565b610b8a565b60ff82161580610b66575060ff8116155b610b8a5781610b7481611026565b9250508080610b8290611026565b915050610b2d565b50509050949350505050565b6000600160ff841615610c31576000610bb060018661100d565b90506000610bbf876001610fee565b90505b60078160ff161015610c2e57610bda88838388610cc5565b15610bf15782610be981610fd5565b935050610bf6565b610c2e565b60ff82161580610c0a575060068160ff1610155b610c2e5781610c1881611026565b9250508080610c2690610fb6565b915050610bc2565b50505b60ff8516156109dc576000610c47856001610fee565b90506000610c5660018861100d565b90505b60068260ff16108015610c6a575060015b15610b8a57610c7b88838388610cc5565b15610b505782610c8a81610fd5565b93505060068260ff16101580610ca1575060ff8116155b610b8a5781610caf81610fb6565b9250508080610cbd90611026565b915050610c59565b600080600160008760ff16815260200190815260200160002060030190508260ff16818660ff1660068110610cfc57610cfc610f8a565b018560ff1660078110610d1157610d11610f8a565b602081049091015460ff601f9092166101000a90041614915050949350505050565b6040518060c001604052806006905b610d4a610daa565b815260200190600190039081610d425790505090565b8260068101928215610d9a579160200282015b82811115610d9a578251610d8a9083906007610dc8565b5091602001919060010190610d73565b50610da6929150610e57565b5090565b6040518060e001604052806007906020820280368337509192915050565b600183019183908215610e4b5791602002820160005b83821115610e1c57835183826101000a81548160ff021916908360ff1602179055509260200192600101602081600001049283019260010302610dde565b8015610e495782816101000a81549060ff0219169055600101602081600001049283019260010302610e1c565b505b50610da6929150610e6b565b80821115610da65760008155600101610e57565b80821115610da65760008155600101610e57565b600060208284031215610e9157600080fd5b81356001600160a01b0381168114610ea857600080fd5b9392505050565b803560ff81168114610ec057600080fd5b919050565b600060208284031215610ed757600080fd5b610ea882610eaf565b60008060408385031215610ef357600080fd5b610efc83610eaf565b9150610f0a60208401610eaf565b90509250929050565b610540810181836000805b6006811015610f6757825184835b6007811015610f4e57825160ff16825260209283019290910190600101610f2c565b50505060e0939093019260209290920191600101610f1e565b5050505092915050565b600060208284031215610f8357600080fd5b5035919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060ff821660ff8103610fcc57610fcc610fa0565b60010192915050565b600060018201610fe757610fe7610fa0565b5060010190565b60ff818116838216019081111561100757611007610fa0565b92915050565b60ff828116828216039081111561100757611007610fa0565b600060ff82168061103957611039610fa0565b600019019291505056fea2646970667358221220c1283337ae4a32c0cdeb6b7daa81c0d957649e9fa82a9988d5ca1c5bda980fe564736f6c63430008110033"; type ConnectFourConstructorParams = | [signer?: Signer]