-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #559 from sarvesh-ost/mint_ost_prime_as_base_token
Mint ost prime as base token
- Loading branch information
Showing
15 changed files
with
394 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
pragma solidity ^0.5.0; | ||
|
||
// Copyright 2018 OpenST Ltd. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// 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 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 | ||
// limitations under the License. | ||
// | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// http://www.simpletoken.org/ | ||
// | ||
// ---------------------------------------------------------------------------- | ||
|
||
/** @title MutexAddress contract provide locking mechanism. */ | ||
contract MutexAddress { | ||
|
||
/* Storage */ | ||
|
||
/** Mapping of address and lock status. */ | ||
mapping(address => bool) private locks; | ||
|
||
|
||
/* Constructor */ | ||
|
||
constructor() public | ||
{ } | ||
|
||
/** | ||
* @notice This acquires lock for an account if not already acquired. | ||
* This will revert the transaction if lock is already acquired. | ||
* | ||
* @param _account Account for which lock acquisition is required. | ||
* | ||
* @return isAcquired_ `true` on successful lock acquisition, `false` otherwise. | ||
*/ | ||
function acquire(address _account) | ||
internal | ||
returns(bool isAcquired_) | ||
{ | ||
require( | ||
locks[_account] == false, | ||
"Lock already acquired for the account." | ||
); | ||
|
||
locks[_account] = true; | ||
isAcquired_ = true; | ||
} | ||
|
||
/** | ||
* @notice This releases lock for an account if lock is acquired. | ||
* This will revert the transaction if lock is not acquired. | ||
* | ||
* @param _account Account for which release lock is required. | ||
* | ||
* @return isReleased_ `true` on successful lock release, `false` otherwise. | ||
*/ | ||
function release(address _account) | ||
internal | ||
returns(bool isReleased_) | ||
{ | ||
require( | ||
locks[_account] == true, | ||
"Lock is not acquired for the address." | ||
); | ||
|
||
locks[_account] = false; | ||
isReleased_ = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
pragma solidity ^0.5.0; | ||
|
||
// Copyright 2018 OpenST Ltd. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// 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 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 | ||
// limitations under the License. | ||
// | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// http://www.simpletoken.org/ | ||
// | ||
// ---------------------------------------------------------------------------- | ||
|
||
import "../lib/MutexAddress.sol"; | ||
|
||
/** @title TestMutexAddress contract to test Mutex. */ | ||
contract TestMutexAddress is MutexAddress { | ||
|
||
constructor() | ||
MutexAddress() | ||
public | ||
{ } | ||
|
||
/** | ||
* @notice This acquires lock for an account if not already acquired. | ||
* This will revert the transaction if lock is already acquired. | ||
* | ||
* @param _account Account for which lock acquisition is required. | ||
* | ||
* @return isAcquired_ `true` on successful lock acquisition, `false` otherwise. | ||
*/ | ||
function acquireExternal(address _account) | ||
external | ||
returns(bool success_) | ||
{ | ||
success_ = super.acquire(_account); | ||
} | ||
|
||
/** | ||
* @notice This releases lock for an account if lock is acquired. | ||
* This will revert the transaction if lock is not acquired. | ||
* | ||
* @param _account Account for which release lock is required. | ||
* | ||
* @return isReleased_ `true` on successful lock release, `false` otherwise. | ||
*/ | ||
function releaseExternal(address _account) | ||
external | ||
returns(bool success_) | ||
{ | ||
success_ = super.release(_account); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.