Skip to content

Commit

Permalink
Merge pull request #313 from BoostryJP/dev-21.6.0
Browse files Browse the repository at this point in the history
21.6.0_beta1
  • Loading branch information
YoshihitoAso authored Jul 6, 2021
2 parents 1b57e4c + 300ecb3 commit 9164f30
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 73 deletions.
17 changes: 17 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# How to Contribute

At this time, we are not yet accepting external code contributions to this
project. However, we want this library to be useful for the community. Submit
issues for any feature request, bug, or other issue regarding the library. We
will respond to issues filed in this project.

We also want to know how you use this library and what problems it helps you to
solve. We have two communication channels for you to contact us:

* A [public discussion group](https://github.com/BoostryJP/ibet-SmartContract/discussions)
where we will also share our preliminary roadmap, updates, events, and more.

* A private email alias at
[[email protected]](mailto:[email protected])
where you can reach out to us directly about your use cases and what more we can
do to help and improve the library.
71 changes: 0 additions & 71 deletions CONTRIBUTING_ja.md

This file was deleted.

46 changes: 44 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# ibet Smart Contract

<p>
<img alt="Version" src="https://img.shields.io/badge/version-21.5-blue.svg?cacheSeconds=2592000" />
<img alt="Version" src="https://img.shields.io/badge/version-21.6-blue.svg?cacheSeconds=2592000" />
<a href="#" target="_blank">
<img alt="License: Apache--2.0" src="https://img.shields.io/badge/License-Apache--2.0-yellow.svg" />
</a>
Expand Down Expand Up @@ -50,7 +50,30 @@ To deploy, execute the following command.
$ ./scripts/deploy.sh
```

## Running the tests
## Developing Smart Contracts

### Requirements
* Python(3.6)
* Ganache

### Setting up Ganache

#### Server
* hostname : 127.0.0.1 - lo0
* port number : 8545
* chain id : 2017

#### Chain
* gas price : 0
* hard fork : Petersburg

#### Importing network settings to Brownie

```bash
$ brownie networks import data/networks.yml
```

### Running the tests

You can run the tests with:
```bash
Expand All @@ -66,6 +89,25 @@ $ pytest tests/

ibet-SmartContract is licensed under the Apache License, Version 2.0.


## Contact information

We are committed to open-sourcing our work to support your use cases.
We want to know how you use this library and what problems it helps you to solve.
We have two communication channels for you to contact us:

* A [public discussion group](https://github.com/BoostryJP/ibet-SmartContract/discussions)
where we will also share our preliminary roadmap, updates, events, and more.

* A private email alias at
[[email protected]](mailto:[email protected])
where you can reach out to us directly about your use cases and what more we can
do to help and improve the library.

Please refrain from sending any sensitive or confidential information.
If you wish to delete a message you've previously sent, please contact us.


## Sponsors

[BOOSTRY Co., Ltd.](https://boostry.co.jp/)
15 changes: 15 additions & 0 deletions contracts/IbetShare.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ contract IbetShare is Ownable, IbetStandardTokenInterface {
bool public offeringStatus; // 募集ステータス(True:募集中、False:停止中)
bool public transferApprovalRequired; // 移転承認要否
uint256 public principalValue; // 一口あたりの元本額
bool public isCanceled; // 消却状況

// 配当情報
struct DividendInformation {
Expand Down Expand Up @@ -119,6 +120,9 @@ contract IbetShare is Ownable, IbetStandardTokenInterface {
// イベント:減資
event Redeem(address indexed from, address indexed target_address, address indexed locked_address, uint256 amount);

// イベント:消却
event Cancel();

// イベント:移転承諾要否変更
event ChangeTransferApprovalRequired(bool required);

Expand Down Expand Up @@ -163,6 +167,7 @@ contract IbetShare is Ownable, IbetStandardTokenInterface {
dividendInformation.dividendRecordDate = _dividendRecordDate;
dividendInformation.dividendPaymentDate = _dividendPaymentDate;
cancellationDate = _cancellationDate;
isCanceled = false;
status = true;
balances[owner] = totalSupply;
}
Expand Down Expand Up @@ -764,4 +769,14 @@ contract IbetShare is Ownable, IbetStandardTokenInterface {
}
emit Redeem(msg.sender, _target_address, _locked_address, _amount);
}

/// @notice 消却する
/// @dev オーナーのみ実行可能
function cancel()
public
onlyOwner()
{
isCanceled = true;
emit Cancel();
}
}
61 changes: 61 additions & 0 deletions tests/test_ibetshare.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,13 @@ def test_deploy_normal_1(self, IbetShare, users):
name = share_contract.name()
symbol = share_contract.symbol()
issue_price = share_contract.issuePrice()
principal_value = share_contract.principalValue()
total_supply = share_contract.totalSupply()
dividend_information = share_contract.dividendInformation()
cancellation_date = share_contract.cancellationDate()
is_canceled = share_contract.isCanceled()
status = share_contract.status()
balance = share_contract.balanceOf(account_address)

assert owner_address == account_address
assert name == deploy_args[0]
Expand All @@ -80,6 +84,10 @@ def test_deploy_normal_1(self, IbetShare, users):
assert dividend_information[1] == deploy_args[5]
assert dividend_information[2] == deploy_args[6]
assert cancellation_date == deploy_args[7]
assert principal_value == deploy_args[8]
assert is_canceled == False
assert status == True
assert balance == total_supply

# エラー系1: 入力値の型誤り(name)
def test_deploy_error_1(self, users, IbetShare):
Expand Down Expand Up @@ -3184,3 +3192,56 @@ def test_error_1(self, users, personal_info):

# assertion
assert share_token.transferApprovalRequired() == False


# TEST_Cancel
class TestCancel:

################################################################
# Normal Case
################################################################

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

# prepare data
share_token, deploy_args = utils.issue_share_token(
users=users,
exchange_address=zero_address,
personal_info_address=personal_info.address
)

# cancel
share_token.cancel(
{"from": issuer}
)

# assertion
is_canceled = share_token.isCanceled()
assert is_canceled is True

################################################################
# Error Case
################################################################

# Error_1
# No execute permission
def test_error_1(self, users, bond_exchange, personal_info):
user1 = users["user1"]

# prepare data
share_token, deploy_args = utils.issue_share_token(
users=users,
exchange_address=zero_address,
personal_info_address=personal_info.address
)

# cancel
share_token.cancel(
{"from": user1}
)

# assertion
is_canceled = share_token.isCanceled()
assert is_canceled is False

0 comments on commit 9164f30

Please sign in to comment.