Skip to content

Commit b3ada95

Browse files
committed
minor fixes
1 parent db3fbef commit b3ada95

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

contracts/ACash.sol

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ contract ACash is ERC20, Ownable {
2121
using AddressQueue for AddressQueue.Queue;
2222
using BondMinterHelpers for IBondMinter;
2323
using SafeERC20 for IERC20;
24+
using SafeERC20 for ITranche;
2425

2526
// Used for fee and yield values
2627
uint256 public constant PCT_DECIMALS = 6;
@@ -75,30 +76,31 @@ contract ACash is ERC20, Ownable {
7576
}
7677

7778
function mint(uint256[] calldata trancheAmts) external returns (uint256, int256) {
79+
// "System Error: bond minter not set."
7880
// assert(bondMinter != address(0));
7981

8082
IBondController mintingBond = IBondController(bondQueue.tail());
8183
require (address(mintingBond) != address(0), "No active minting bond");
8284

8385
uint256 trancheCount = mintingBond.trancheCount();
84-
8586
require(trancheAmts.length == trancheCount, "Must specify amounts for every bond tranche");
8687

8788
uint256[] storage yields = trancheYields[bondMinter];
8889
// "System Error: trancheYields size doesn't match bond tranche count."
89-
assert(yields.length == trancheCount);
90+
// assert(yields.length == trancheCount);
9091

9192
uint256 mintAmt = 0;
9293
for (uint256 i = 0; i < trancheCount; i++) {
9394
mintAmt += yields[i] * trancheAmts[i] / (10 ** PCT_DECIMALS);
95+
9496
(ITranche t, ) = mintingBond.tranches(i);
95-
IERC20(address(t)).safeTransferFrom(msg.sender, address(this), trancheAmts[i]); // assert or use safe transfer
97+
t.safeTransferFrom(msg.sender, address(this), trancheAmts[i]);
9698
}
9799

98100
// transfer in fee
99101
int256 fee = mintFeePct * int256(mintAmt) / int256(10 ** PCT_DECIMALS);
100102
if (fee >= 0) {
101-
IERC20(feeToken).safeTransferFrom(msg.sender, address(this), uint256(fee)); // todo: safe versions
103+
IERC20(feeToken).safeTransferFrom(msg.sender, address(this), uint256(fee));
102104
} else {
103105
// This is very scary!
104106
IERC20(feeToken).safeTransfer(msg.sender, uint256(-fee));
@@ -132,7 +134,7 @@ contract ACash is ERC20, Ownable {
132134
// push individual tranches into icebox if they have a balance
133135
for(uint256 i = 0; i < latestBond.trancheCount(); i++){
134136
(ITranche t,) = latestBond.tranches(i);
135-
if(ITranche.balanceOf(address(this)) > 0){
137+
if(t.balanceOf(address(this)) > 0){
136138
trancheIcebox[t] = true;
137139
}
138140
}

0 commit comments

Comments
 (0)