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

Change the attributes purpose and redemption_date defined in bond to updatable attributes #453

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 14 additions & 0 deletions contracts/token/IbetStraightBond.sol
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,13 @@ contract IbetStraightBond is Ownable, IbetSecurityTokenInterface {
emit ChangeFaceValue(_faceValue);
}

/// @notice 償還日の更新
/// @dev オーナーのみ実行可能
/// @param _redemptionDate 更新後の償還日
function setRedemptionDate(string memory _redemptionDate) public onlyOwner {
redemptionDate = _redemptionDate;
}

/// @notice 償還金額の更新
/// @dev オーナーのみ実行可能
/// @param _redemptionValue 更新後の償還金額
Expand All @@ -427,6 +434,13 @@ contract IbetStraightBond is Ownable, IbetSecurityTokenInterface {
emit ChangeTransferApprovalRequired(_required);
}

/// @notice 発行目的の更新
/// @dev オーナーのみ実行可能
/// @param _purpose 更新後の発行目的
function setPurpose(string memory _purpose) public onlyOwner {
purpose = _purpose;
}

/// @notice 額面金額通貨の更新
/// @dev オーナーのみ実行可能
/// @param _faceValueCurrency 更新後の額面金額通貨
Expand Down
84 changes: 84 additions & 0 deletions tests/token/test_IbetStraightBond.py
Original file line number Diff line number Diff line change
Expand Up @@ -2661,6 +2661,48 @@ def test_error_1(self, users, IbetStraightBond):
assert bond_token.redemptionValue() == deploy_args[6]


# TEST_setRedemptionDate
class TestSetRedemptionDate:

#######################################
# Normal
#######################################

# Normal_1
def test_normal_1(self, users, IbetStraightBond):
issuer = users["issuer"]

# issue token
deploy_args = init_args()
bond_token = brownie_utils.force_deploy(issuer, IbetStraightBond, *deploy_args)

# update
bond_token.setRedemptionDate("20240813", {"from": issuer})

# assertion
assert bond_token.redemptionDate() == "20240813"

#######################################
# Error
#######################################

# Error_1
# Not authorized
def test_error_1(self, users, IbetStraightBond):
issuer = users["issuer"]

# issue token
deploy_args = init_args()
bond_token = brownie_utils.force_deploy(issuer, IbetStraightBond, *deploy_args)

# update
with brownie.reverts(revert_msg="500001"):
bond_token.setRedemptionDate("20240813", {"from": users["user1"]})

# assertion
assert bond_token.redemptionDate() == deploy_args[5]


# TEST_setTransferApprovalRequired
class TestSetTransferApprovalRequired:

Expand Down Expand Up @@ -2725,6 +2767,48 @@ def test_error_1(self, users, personal_info):
assert bond_token.transferApprovalRequired() == False


# TEST_setPurpose
class TestSetPurpose:

#######################################
# Normal
#######################################

# Normal_1
def test_normal_1(self, users, IbetStraightBond):
issuer = users["issuer"]

# issue token
deploy_args = init_args()
bond_token = brownie_utils.force_deploy(issuer, IbetStraightBond, *deploy_args)

# update
bond_token.setPurpose("updated_purpose", {"from": issuer})

# assertion
assert bond_token.purpose() == "updated_purpose"

#######################################
# Error
#######################################

# Error_1
# Not authorized
def test_error_1(self, users, IbetStraightBond):
issuer = users["issuer"]

# issue token
deploy_args = init_args()
bond_token = brownie_utils.force_deploy(issuer, IbetStraightBond, *deploy_args)

# update
with brownie.reverts(revert_msg="500001"):
bond_token.setPurpose("updated_purpose", {"from": users["user1"]})

# assertion
assert bond_token.purpose() == deploy_args[10]


# TEST_setFaceValueCurrency
class TestSetFaceValueCurrency:

Expand Down
Loading