Skip to content

Commit

Permalink
refactor: rename transfer to not only verify summary
Browse files Browse the repository at this point in the history
  • Loading branch information
QGarchery committed Aug 17, 2023
1 parent 5b9dc63 commit e0a9b50
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/certora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ jobs:
- verifyBlue.sh
- verifyBlueRatioMathSummary.sh
- verifyBlueExitLiquidity.sh
- verifyBlueTransferSummary.sh
- verifyBlueTransfer.sh
- verifyReentrancy.sh
12 changes: 7 additions & 5 deletions certora/harness/TransferHarness.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@ import "../../src/libraries/SafeTransferLib.sol";
import "../../src/interfaces/IERC20.sol";

interface IERC20Extended is IERC20 {
function balanceOf(address) external returns (uint256);
function totalSupply() external returns (uint256);
function balanceOf(address) external view returns (uint256);
function totalSupply() external view returns (uint256);
}

contract TransferHarness {
using SafeTransferLib for IERC20;

function doTransfer(address token, address from, address to, uint256 value) public {
IERC20Extended(token).transferFrom(from, to, value);
IERC20(token).safeTransferFrom(from, to, value);
}

function getBalance(address token, address user) public returns (uint256) {
function getBalance(address token, address user) public view returns (uint256) {
return IERC20Extended(token).balanceOf(user);
}

function getTotalSupply(address token) public returns (uint256) {
function getTotalSupply(address token) public view returns (uint256) {
return IERC20Extended(token).totalSupply();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ certoraRun \
certora/dispatch/ERC20Good.sol \
certora/dispatch/ERC20USDT.sol \
certora/dispatch/ERC20NoRevert.sol \
--verify TransferHarness:certora/specs/BlueTransferSummary.spec \
--verify TransferHarness:certora/specs/BlueTransfer.spec \
--packages openzeppelin-contracts=lib/openzeppelin-contracts/contracts \
--loop_iter 3 \
--optimistic_loop \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function summarySafeTransferFrom(address token, address from, address to, uint25
}
}

rule checkTransferSummary(address token, address from, address to, uint256 amount) {
rule checkTransfer(address token, address from, address to, uint256 amount) {
require from == currentContract || to == currentContract;

require from != to => getBalance(token, from) + getBalance(token, to) <= to_mathint(getTotalSupply(token));
Expand Down

0 comments on commit e0a9b50

Please sign in to comment.