Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use solidity naming convention #254

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
merge audit hacken branch
  • Loading branch information
joshualyguessennd committed Nov 28, 2023
commit bcbc4288e129a0f659b782a50f555af8e6ef5dd6
8 changes: 5 additions & 3 deletions src/dividend/XDShare.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import {ReentrancyGuardUpgradeable} from
import {SafeERC20, IERC20} from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";

/**
* @title XdShare Contract
* @title XDShare Contract
* @dev This contract acts as a wrapper over the DShare token, providing additional functionalities.
* It serves as a reinvestment token that uses DShare as the underlying token.
* Additionally, it employs the ERC4626 standard for its operations.
* If TokenManager is not used, make sure that DShare will never split.
* @author Dinari (https://github.com/dinaricrypto/sbt-contracts/blob/main/src/XdShare.sol)
* @author Dinari (https://github.com/dinaricrypto/sbt-contracts/blob/main/src/XDShare.sol)
*/
// slither-disable-next-line missing-inheritance
contract XdShare is Initializable, ERC4626, OwnableUpgradeable, ReentrancyGuardUpgradeable {
contract XDShare is Initializable, ERC4626, OwnableUpgradeable, ReentrancyGuardUpgradeable {
/// ------------------- Types ------------------- ///

using SafeERC20 for IERC20;
Expand Down Expand Up @@ -49,6 +49,8 @@ contract XdShare is Initializable, ERC4626, OwnableUpgradeable, ReentrancyGuardU
__Ownable_init_unchained(msg.sender);
__ReentrancyGuard_init_unchained();

if (address(dShare_) == address(0)) revert ZeroAddress();

XdShareStorage storage $ = _getXdShareStorage();
$._underlyingDShare = dShare_;
$._name = name_;
Expand Down
10 changes: 5 additions & 5 deletions test/main/DualDistributor.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "forge-std/Test.sol";
import {DividendDistribution} from "../../src/dividend/DividendDistribution.sol";
import {DualDistributor} from "../../src/dividend/DualDistributor.sol";
import {TransferRestrictor, ITransferRestrictor} from "../../src/TransferRestrictor.sol";
import {XdShare} from "../../src/dividend/XDShare.sol";
import {XDShare} from "../../src/dividend/XDShare.sol";
import {DShare} from "../../src/DShare.sol";
import "solady/test/utils/mocks/MockERC20.sol";
import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
Expand All @@ -16,7 +16,7 @@ contract DualDistributorTest is Test {
DividendDistribution distribution;
DualDistributor dualDistributor;
TransferRestrictor restrictor;
XdShare xToken;
XDShare xToken;
DShare dtoken;
MockERC20 token;

Expand All @@ -43,12 +43,12 @@ contract DualDistributorTest is Test {
)
)
);
XdShare xtokenImplementation = new XdShare();
xToken = XdShare(
XDShare xtokenImplementation = new XDShare();
xToken = XDShare(
address(
new ERC1967Proxy(
address(xtokenImplementation),
abi.encodeCall(XdShare.initialize, (dtoken, "Dinari xdToken", "xdTKN"))
abi.encodeCall(XDShare.initialize, (dtoken, "Dinari xdToken", "xdTKN"))
)
)
);
Expand Down
18 changes: 9 additions & 9 deletions test/main/xdShare.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ pragma solidity 0.8.22;

import "forge-std/Test.sol";
import {DShare} from "../../src/DShare.sol";
import {XdShare} from "../../src/dividend/XDShare.sol";
import {XDShare} from "../../src/dividend/XDShare.sol";
import {TransferRestrictor, ITransferRestrictor} from "../../src/TransferRestrictor.sol";
import {ERC1967Proxy} from "openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol";

contract XdShareTest is Test {
TransferRestrictor public restrictor;
DShare public token;
XdShare public xToken;
XDShare public xToken;

address user = address(1);
address user2 = address(2);
Expand All @@ -29,12 +29,12 @@ contract XdShareTest is Test {
);
token.grantRole(token.MINTER_ROLE(), address(this));

XdShare xtokenImplementation = new XdShare();
xToken = XdShare(
XDShare xtokenImplementation = new XDShare();
xToken = XDShare(
address(
new ERC1967Proxy(
address(xtokenImplementation),
abi.encodeCall(XdShare.initialize, (token, "Reinvesting dTKN.d", "dTKN.d.x"))
abi.encodeCall(XDShare.initialize, (token, "Reinvesting dTKN.d", "dTKN.d.x"))
)
)
);
Expand All @@ -59,13 +59,13 @@ contract XdShareTest is Test {
}

function testIntializationZeroAddress() public {
xdShare xtokenImplementation = new xdShare();
vm.expectRevert(xdShare.ZeroAddress.selector);
xdShare(
XDShare xtokenImplementation = new XDShare();
vm.expectRevert(XDShare.ZeroAddress.selector);
XDShare(
address(
new ERC1967Proxy(
address(xtokenImplementation),
abi.encodeCall(xdShare.initialize, (dShare(address(0)), "Reinvesting dTKN.d", "dTKN.d.x"))
abi.encodeCall(XDShare.initialize, (DShare(address(0)), "Reinvesting dTKN.d", "dTKN.d.x"))
)
)
);
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.