Skip to content

Commit

Permalink
Merge pull request #25 from hollygrimm/erc20pausable
Browse files Browse the repository at this point in the history
add ERC20Pausable
  • Loading branch information
DeveloperAlly authored Oct 30, 2023
2 parents 9c7bd6c + 197fc39 commit 275e5f3
Show file tree
Hide file tree
Showing 3 changed files with 367 additions and 4 deletions.
17 changes: 15 additions & 2 deletions hardhat/contracts/LilypadToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity ^0.8.6;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol";
import "./ControllerOwnable.sol";

/*
Expand Down Expand Up @@ -33,7 +34,7 @@ import "./ControllerOwnable.sol";
now, only the payments contract can call the escrow functions that pay out
*/
contract LilypadToken is ControllerOwnable, ERC20 {
contract LilypadToken is ControllerOwnable, ERC20, ERC20Pausable {

// keep track of the current escrow balance for each address
mapping(address => uint256) private escrowBalances;
Expand Down Expand Up @@ -101,4 +102,16 @@ contract LilypadToken is ControllerOwnable, ERC20 {
_transfer(address(this), owner(), amount);
return true;
}
}

function pause() public onlyOwner {
_pause();
}

function unpause() public onlyOwner {
_unpause();
}

function _beforeTokenTransfer(address from, address to, uint256 amount) internal override(ERC20, ERC20Pausable) {
super._beforeTokenTransfer(from, to, amount);
}
}
9 changes: 9 additions & 0 deletions hardhat/test/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,5 +567,14 @@ describe("Controller", () => {
await checkAgreement(storage, 'MediationRejected')
})

it("Revert agree on deal when token contract is paused", async function () {
const {
token,
controller,
} = await loadFixture(setupController)
await token.connect(getWallet('admin')).pause()
await expect(agree(controller, 'job_creator')).to.be.revertedWith('ERC20Pausable: token transfer while paused')
})

})
})
Loading

0 comments on commit 275e5f3

Please sign in to comment.