Skip to content

Commit 81f1899

Browse files
committed
chore: add natspec comments
1 parent 8cffeb8 commit 81f1899

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

src/DssBlow2.sol

+28-2
Original file line numberDiff line numberDiff line change
@@ -13,47 +13,73 @@
1313
//
1414
// You should have received a copy of the GNU Affero General Public License
1515
// along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
1617
pragma solidity ^0.8.24;
1718

1819
interface ERC20Like {
19-
function balanceOf(address) external view returns (uint256);
20+
function balanceOf(address account) external view returns (uint256);
2021
function approve(address usr, uint256 wad) external returns (bool);
2122
}
2223

2324
interface DaiJoinLike {
2425
function dai() external view returns (address);
25-
function join(address, uint256) external;
26+
function join(address usr, uint256 wad) external;
2627
}
2728

2829
interface UsdsJoinLike is DaiJoinLike {
2930
function usds() external view returns (address);
3031
}
3132

33+
/// @title DssBlow2
34+
/// @notice This contract acts as a bridge to incorporate any available Dai or USDS
35+
/// balances into the protocol's Surplus Buffer by invoking the appropriate join adapters.
36+
/// @dev The contract automatically approves the maximum token amount for both join adapters during construction.
3237
contract DssBlow2 {
38+
/// @notice The address of the Vow contract that receives tokens.
3339
address public immutable vow;
40+
41+
/// @notice The ERC20 token representing Dai.
3442
ERC20Like public immutable dai;
43+
44+
/// @notice The ERC20 token representing USDS.
3545
ERC20Like public immutable usds;
46+
47+
/// @notice The adapter for joining Dai into the protocol.
3648
DaiJoinLike public immutable daiJoin;
49+
50+
/// @notice The adapter for joining USDS into the protocol.
3751
UsdsJoinLike public immutable usdsJoin;
3852

53+
/// @notice Emitted when tokens are transferred into the protocol.
54+
/// @param token The address of the token (Dai or USDS) that was transferred.
55+
/// @param amount The amount of tokens that was transferred.
3956
event Blow(address indexed token, uint256 amount);
4057

58+
/// @notice Initializes the DssBlow2 contract.
59+
/// @param daiJoin_ The address of the DaiJoin contract.
60+
/// @param usdsJoin_ The address of the UsdsJoin contract.
61+
/// @param vow_ The address of the Vow contract.
4162
constructor(address daiJoin_, address usdsJoin_, address vow_) {
4263
daiJoin = DaiJoinLike(daiJoin_);
4364
dai = ERC20Like(daiJoin.dai());
4465
usdsJoin = UsdsJoinLike(usdsJoin_);
4566
usds = ERC20Like(usdsJoin.usds());
4667
vow = vow_;
68+
69+
// Approve the maximum uint256 amount for both join adapters.
4770
dai.approve(daiJoin_, type(uint256).max);
4871
usds.approve(usdsJoin_, type(uint256).max);
4972
}
5073

74+
/// @notice Transfers any available Dai and USDS balances from this contract to the protocol's Surplus Buffer.
75+
/// @dev For each token, if the balance is greater than zero, the respective join adapter's join function is called.
5176
function blow() public {
5277
uint256 daiBalance = dai.balanceOf(address(this));
5378
if (daiBalance > 0) {
5479
daiJoin.join(vow, daiBalance);
5580
emit Blow(address(dai), daiBalance);
5681
}
82+
5783
uint256 usdsBalance = usds.balanceOf(address(this));
5884
if (usdsBalance > 0) {
5985
usdsJoin.join(vow, usdsBalance);

0 commit comments

Comments
 (0)