-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(FileAnalyzer): update regex to find top level keywords
relates: rkalis/truffle-plugin-verify#13
- Loading branch information
Showing
5 changed files
with
119 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
pragma solidity ^0.5.0; | ||
|
||
|
||
contract Ownable { | ||
address public owner; | ||
|
||
function Ownable() { | ||
owner = msg.sender; | ||
} | ||
|
||
modifier onlyOwner() { | ||
require(msg.sender == owner); | ||
_; | ||
} | ||
|
||
function transferOwnership(address newOwner) onlyOwner { | ||
if (newOwner != address(0)) { | ||
owner = newOwner; | ||
} | ||
} | ||
|
||
} | ||
|
||
contract Manager is Ownable { | ||
function mintSupply(address src20, address swmAccount, uint256 swmValue, uint256 src20Value) | ||
onlyOwner | ||
external | ||
returns (bool) | ||
{ | ||
require(swmAccount != address(0), "SWM account is zero"); | ||
require(swmValue != 0, "SWM value is zero"); | ||
require(src20Value != 0, "SRC20 value is zero"); | ||
require(_registry[src20].owner != address(0), "SRC20 token contract not registered"); | ||
|
||
_registry[src20].stake = _registry[src20].stake.add(swmValue); | ||
_registry[src20]._swm = swmValue; | ||
_registry[src20]._src = src20Value; | ||
|
||
require(_swmERC20.transferFrom(swmAccount, address(this), swmValue)); | ||
require(ISRC20Managed(src20).mint(_registry[src20].owner, src20Value)); | ||
|
||
emit SRC20SupplyMinted(src20, swmAccount, swmValue, src20Value); | ||
|
||
return true; | ||
} | ||
|
||
function incStake(address src20, address swmAccount, uint256 swmValue) | ||
external | ||
onlyTokenOwner(src20) | ||
returns (bool) | ||
{ | ||
require(swmAccount != address(0), "SWM account is zero"); | ||
require(swmValue != 0, "SWM value is zero"); | ||
require(_registry[src20].owner != address(0), "SRC20 token contract not registered"); | ||
require(_registry[src20]._swm != 0, "Token not minted"); | ||
|
||
_registry[src20].stake = _registry[src20].stake.add(swmValue); | ||
|
||
require(_swmERC20.transferFrom(swmAccount, address(this), swmValue)); | ||
require(ISRC20Managed(src20).mint(_registry[src20].owner, _calcTokens(src20, swmValue))); | ||
|
||
emit SRC20StakeIncreased(src20, swmAccount, swmValue); | ||
|
||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
pragma solidity ^0.5.0; | ||
|
||
import "./imports/ownable.sol"; | ||
|
||
contract Manager is Ownable { | ||
function mintSupply(address src20, address swmAccount, uint256 swmValue, uint256 src20Value) | ||
onlyOwner | ||
external | ||
returns (bool) | ||
{ | ||
require(swmAccount != address(0), "SWM account is zero"); | ||
require(swmValue != 0, "SWM value is zero"); | ||
require(src20Value != 0, "SRC20 value is zero"); | ||
require(_registry[src20].owner != address(0), "SRC20 token contract not registered"); | ||
|
||
_registry[src20].stake = _registry[src20].stake.add(swmValue); | ||
_registry[src20]._swm = swmValue; | ||
_registry[src20]._src = src20Value; | ||
|
||
require(_swmERC20.transferFrom(swmAccount, address(this), swmValue)); | ||
require(ISRC20Managed(src20).mint(_registry[src20].owner, src20Value)); | ||
|
||
emit SRC20SupplyMinted(src20, swmAccount, swmValue, src20Value); | ||
|
||
return true; | ||
} | ||
|
||
function incStake(address src20, address swmAccount, uint256 swmValue) | ||
external | ||
onlyTokenOwner(src20) | ||
returns (bool) | ||
{ | ||
require(swmAccount != address(0), "SWM account is zero"); | ||
require(swmValue != 0, "SWM value is zero"); | ||
require(_registry[src20].owner != address(0), "SRC20 token contract not registered"); | ||
require(_registry[src20]._swm != 0, "Token not minted"); | ||
|
||
_registry[src20].stake = _registry[src20].stake.add(swmValue); | ||
|
||
require(_swmERC20.transferFrom(swmAccount, address(this), swmValue)); | ||
require(ISRC20Managed(src20).mint(_registry[src20].owner, _calcTokens(src20, swmValue))); | ||
|
||
emit SRC20StakeIncreased(src20, swmAccount, swmValue); | ||
|
||
return 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