Skip to content

Commit 4de8b1c

Browse files
committed
feat: downgrade @openzeppelin/[email protected]
1 parent 8a0ab6d commit 4de8b1c

File tree

5 files changed

+17
-12
lines changed

5 files changed

+17
-12
lines changed

contracts/Token.sol

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pragma solidity >=0.8.20;
33

44
import "@openzeppelin/contracts/access/Ownable.sol";
5-
import "@openzeppelin/contracts/utils/Pausable.sol";
5+
import "@openzeppelin/contracts/security/Pausable.sol";
66
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
77

88
/// @title Kolektivo TTD Token
@@ -18,7 +18,7 @@ contract KolektivoTTD is Ownable, Pausable, ERC20 {
1818
/// @dev Check this list on transfer for special events
1919
mapping(address => bool) _isImpactPartner;
2020

21-
constructor() ERC20("Kolektivo Trinidad & Tobago Dollar", "KTTD") Ownable(msg.sender) {}
21+
constructor() ERC20("Kolektivo Trinidad & Tobago Dollar", "KTTD") Ownable() {}
2222

2323
/// @notice Disburse tokens to an account.
2424
/// @dev Only the owner can disburse tokens, and they are
@@ -37,11 +37,11 @@ contract KolektivoTTD is Ownable, Pausable, ERC20 {
3737
super._transfer(address(this), address(0), amount);
3838
}
3939

40-
function _update(address from, address to, uint256 amount) internal virtual override {
40+
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
4141
if (_isImpactPartner[to]) {
4242
emit ImpactPartnerTransfer(from, to, amount);
4343
}
44-
super._update(from, to, amount);
44+
super._beforeTokenTransfer(from, to, amount);
4545
}
4646

4747
function addPartner(address account) external onlyOwner {

deploy/deploy.ts

+7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ import { HardhatRuntimeEnvironment } from "hardhat/types";
44
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
55
const { deployer } = await hre.getNamedAccounts();
66
const { deploy } = hre.deployments;
7+
8+
const token = await deploy("KolektivoTTD", {
9+
from: deployer,
10+
log: true,
11+
});
12+
13+
console.log("Token deployed to:", token.address);
714
};
815

916
export default func;

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"typechain": "cross-env TS_NODE_TRANSPILE_ONLY=true hardhat typechain"
7878
},
7979
"dependencies": {
80-
"@openzeppelin/contracts": "^5.0.1"
80+
"@openzeppelin/contracts": "^4.9.4"
8181
},
8282
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
8383
}

test/minting.test.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,15 @@ describe("Minting", function () {
5050
const [_, alice] = await ethers.getSigners();
5151
await this.token.connect(this.signers.admin).mint(alice.address, 100n);
5252
await this.token.connect(this.signers.admin).pause();
53+
await expect(await this.token.connect(this.signers.admin).paused()).to.be.true;
5354
});
5455

5556
it("cannot mint when paused", async function () {
5657
const transferAmount = 100n;
5758
const [_, bob] = await ethers.getSigners();
58-
await expect(
59-
this.token.connect(this.signers.admin).mint(bob.address, transferAmount),
60-
).to.be.revertedWithCustomError(this.token, "EnforcedPause");
59+
await expect(this.token.connect(this.signers.admin).mint(bob.address, transferAmount)).to.be.revertedWith(
60+
"Pausable: paused",
61+
);
6162
});
6263
});
6364
});

test/transfer.test.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,7 @@ describe("Transfering", function () {
4646
it("can transfer when paused", async function () {
4747
const transferAmount = 100n;
4848
const [_, alice, bob] = await ethers.getSigners();
49-
await expect(this.token.connect(alice).transfer(bob.address, transferAmount)).to.not.be.revertedWithCustomError(
50-
this.token,
51-
"EnforcedPause",
52-
);
49+
await expect(this.token.connect(alice).transfer(bob.address, transferAmount)).to.not.be.reverted;
5350
});
5451
});
5552

0 commit comments

Comments
 (0)