Skip to content

Commit

Permalink
Merge pull request #274 from BoostryJP/Release
Browse files Browse the repository at this point in the history
v1.0.0
  • Loading branch information
YoshihitoAso authored Jan 4, 2021
2 parents 1c3139d + b584db4 commit 3a68df7
Show file tree
Hide file tree
Showing 48 changed files with 264 additions and 130 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ __pycache__
.history
.hypothesis
build/
output/
reports/
.vscode/
.idea/

#pyenv
.python-version

!.gitkeep
12 changes: 10 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,23 @@ RUN apt-get update && \
libyaml-cpp-dev \
libgcc1 \
libstdc++6 \
libz3-dev
libz3-dev \
jq \
expect

# Solidity
USER root
RUN wget -q https://github.com/ethereum/solidity/releases/download/v0.4.25/solidity-ubuntu-trusty.zip && \
unzip solidity-ubuntu-trusty.zip && \
cp solc /usr/bin && \
chmod 755 /usr/bin/solc && \
rm solc lllc
rm solc lllc solidity-ubuntu-trusty.zip

# AWS CLI
RUN wget -q https://awscli.amazonaws.com/awscli-exe-linux-$(arch).zip -O awscliv2.zip && \
unzip awscliv2.zip && \
./aws/install && \
rm -r aws awscliv2.zip

# pyenv
RUN git clone https://github.com/pyenv/pyenv.git
Expand Down
14 changes: 13 additions & 1 deletion 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-0.15-blue.svg?cacheSeconds=2592000" />
<img alt="Version" src="https://img.shields.io/badge/version-1.0-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 All @@ -18,6 +18,18 @@ $ pip install -r requirements.txt
```

## Deploy
The EOA used to deploy the contract can be switched by setting environment variables.
1. from GETH
* ETH_ACCOUNT_PASSWORD - The first EOA passphrase.
2. from Ethereum Keystore FILE
* ETH_KEYSTORE_PATH - aaa
* ETH_ACCOUNT_PASSWORD - EOA passphrase.
3. from Ethereum Private Key
* ETH_PRIVATE_KEY - 64 random hex characters.
* ETH_ACCOUNT_PASSWORD - Passphrase to set for generated EOA.
4. from AWS Secrets Manager
* AWS_SECRETS_ID - Secrets's ARN.
* ETH_ACCOUNT_PASSWORD - EOA passphrase.
```bash
$ ./scripts/deploy.sh
```
Expand Down
2 changes: 1 addition & 1 deletion contracts/ExchangeRegulatorService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed onan "AS IS" BASIS,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
Expand Down
2 changes: 1 addition & 1 deletion contracts/ExchangeStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed onan "AS IS" BASIS,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
Expand Down
2 changes: 1 addition & 1 deletion contracts/IbetCoupon.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed onan "AS IS" BASIS,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
Expand Down
11 changes: 4 additions & 7 deletions contracts/IbetCouponExchange.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed onan "AS IS" BASIS,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
Expand Down Expand Up @@ -739,12 +739,9 @@ contract IbetCouponExchange is Ownable {
order.owner, agreement.counterpart, order.price,
agreement.amount, order.agent);
} else {
// 更新処理:売り注文の場合、突合相手(買い手)の注文数量だけ注文者(売り手)の預かりを解放
// -> 預かりの引き出し。
// 取り消した注文は無効化する(注文中状態に戻さない)
setCommitment(order.owner, order.token,
commitmentOf(order.owner, order.token).sub(agreement.amount));
IbetCoupon(order.token).transfer(order.owner,agreement.amount);
// 更新処理:元注文の数量を戻す
setOrder(_orderId, order.owner, order.token, order.amount.add(agreement.amount),
order.price, order.isBuy, order.agent, order.canceled);
// イベント登録:決済NG
emit SettlementNG(order.token, _orderId, _agreementId,
agreement.counterpart, order.owner, order.price,
Expand Down
2 changes: 1 addition & 1 deletion contracts/IbetMembership.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed onan "AS IS" BASIS,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
Expand Down
11 changes: 4 additions & 7 deletions contracts/IbetMembershipExchange.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed onan "AS IS" BASIS,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
Expand Down Expand Up @@ -740,12 +740,9 @@ contract IbetMembershipExchange is Ownable {
order.owner, agreement.counterpart, order.price,
agreement.amount, order.agent);
} else {
// 更新処理:売り注文の場合、突合相手(買い手)の注文数量だけ注文者(売り手)の預かりを解放
// -> 預かりの引き出し。
// 取り消した注文は無効化する(注文中状態に戻さない)
setCommitment(order.owner, order.token,
commitmentOf(order.owner, order.token).sub(agreement.amount));
IbetMembership(order.token).transfer(order.owner,agreement.amount);
// 更新処理:元注文の数量を戻す
setOrder(_orderId, order.owner, order.token, order.amount.add(agreement.amount),
order.price, order.isBuy, order.agent, order.canceled);
// イベント登録:決済NG
emit SettlementNG(order.token, _orderId, _agreementId,
agreement.counterpart, order.owner, order.price,
Expand Down
17 changes: 4 additions & 13 deletions contracts/IbetOTCExchange.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed onan "AS IS" BASIS,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
Expand Down Expand Up @@ -738,18 +738,9 @@ contract IbetOTCExchange is Ownable, OTCExchangeStorageModel {
// 更新処理: キャンセル済みフラグをキャンセル(True)に更新する
OTCExchangeStorage(storageAddress).setAgreementCanceled( _orderId, _agreementId, true);

// 更新処理: 突合相手(買い手)の注文数量だけ注文者(売り手)の預かりを解放
// -> 預かりの引き出し。
// 取り消した注文は無効化する(注文中状態に戻さない)
setCommitment(
order.owner,
order.token,
commitmentOf(order.owner, order.token).sub(agreement.amount)
);
IbetStandardTokenInterface(order.token).transfer(
order.owner,
agreement.amount
);
// 更新処理:元注文の数量を戻す
OTCExchangeStorage(storageAddress).setOrderAmount(_orderId, order.amount.add(agreement.amount));

// イベント登録: 決済NG
emit SettlementNG(
order.token,
Expand Down
2 changes: 1 addition & 1 deletion contracts/IbetShare.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed onan "AS IS" BASIS,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
Expand Down
2 changes: 1 addition & 1 deletion contracts/IbetStraightBond.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed onan "AS IS" BASIS,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
Expand Down
11 changes: 4 additions & 7 deletions contracts/IbetStraightBondExchange.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed onan "AS IS" BASIS,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
Expand Down Expand Up @@ -790,12 +790,9 @@ contract IbetStraightBondExchange is Ownable {
order.owner, agreement.counterpart, order.price,
agreement.amount, order.agent);
} else {
// 更新処理:売り注文の場合、突合相手(買い手)の注文数量だけ注文者(売り手)の預かりを解放
// -> 預かりの引き出し。
// 取り消した注文は無効化する(注文中状態に戻さない)
setCommitment(order.owner, order.token,
commitmentOf(order.owner, order.token).sub(agreement.amount));
IbetStraightBond(order.token).transfer(order.owner, agreement.amount);
// 更新処理:元注文の数量を戻す
setOrder(_orderId, order.owner, order.token, order.amount.add(agreement.amount),
order.price, order.isBuy, order.agent, order.canceled);
// イベント登録:決済NG
emit SettlementNG(order.token, _orderId, _agreementId,
agreement.counterpart, order.owner, order.price,
Expand Down
2 changes: 1 addition & 1 deletion contracts/OTCExchangeStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed onan "AS IS" BASIS,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
Expand Down
2 changes: 1 addition & 1 deletion contracts/OTCExchangeStorageModel.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed onan "AS IS" BASIS,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
Expand Down
2 changes: 1 addition & 1 deletion contracts/Ownable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed onan "AS IS" BASIS,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
Expand Down
2 changes: 1 addition & 1 deletion contracts/PaymentGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed onan "AS IS" BASIS,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
Expand Down
2 changes: 1 addition & 1 deletion contracts/PersonalInfo.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed onan "AS IS" BASIS,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
Expand Down
2 changes: 1 addition & 1 deletion contracts/RegulatorService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed onan "AS IS" BASIS,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
Expand Down
2 changes: 1 addition & 1 deletion contracts/SafeMath.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed onan "AS IS" BASIS,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
Expand Down
2 changes: 1 addition & 1 deletion contracts/TokenList.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed onan "AS IS" BASIS,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
Expand Down
2 changes: 1 addition & 1 deletion interfaces/ContractReceiver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed onan "AS IS" BASIS,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
Expand Down
2 changes: 1 addition & 1 deletion interfaces/IbetStandardTokenInterface.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed onan "AS IS" BASIS,
* software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
Expand Down
Empty file added output/.gitkeep
Empty file.
2 changes: 1 addition & 1 deletion qa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed onan "AS IS" BASIS,
# software distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
# See the License for the specific language governing permissions and
Expand Down
7 changes: 1 addition & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,13 @@ click==6.7
contextlib2==0.5.5
coverage==4.5.4
cytoolz==0.10.1
eth-abi==2.1.1
eth-account==0.5.2
eth-brownie==1.11.11
eth-event==1.2.0
eth-hash==0.2.0
eth-keyfile==0.5.1
eth-keys==0.3.3
eth-rlp==0.1.2
eth-tester==0.1.0b11
eth-testrpc==1.3.3
eth-typing==2.2.1
eth-utils==1.9.5
ethereum==1.6.1
execnet==1.7.1
hexbytes==0.2.1
Expand All @@ -54,7 +49,7 @@ pluggy==0.13.1
prompt-toolkit==3.0.7
protobuf==3.11.3
psutil==5.7.3
py==1.8.1
py==1.8.2
py-geth==2.0.1
py-solc==2.1.0
py-solc-ast==1.2.5
Expand Down
2 changes: 1 addition & 1 deletion scripts/PaymentGateway_addAgent.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed onan "AS IS" BASIS,
software distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
Expand Down
2 changes: 1 addition & 1 deletion scripts/addAgent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed onan "AS IS" BASIS,
# software distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
# See the License for the specific language governing permissions and
Expand Down
Loading

0 comments on commit 3a68df7

Please sign in to comment.