mirror of
https://github.com/status-im/contracts.git
synced 2025-02-22 19:48:44 +00:00
maintance
This commit is contained in:
parent
d0dc312949
commit
e06e998574
@ -1,12 +1,16 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Status Network - Test Demo</title>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
||||
</head>
|
||||
<body class="container">
|
||||
<div id="app">
|
||||
</div>
|
||||
<script src="js/dapp.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
<!doctype html>
|
||||
<html lang="en" dir="ltr">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<link rel="stylesheet" href="css/bootstrap.min.css" />
|
||||
<title>Status Network - Test Demo</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="js/dapp.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -3,15 +3,15 @@ pragma solidity >=0.5.0 <0.6.0;
|
||||
contract Controlled {
|
||||
/// @notice The address of the controller is the only address that can call
|
||||
/// a function with this modifier
|
||||
modifier onlyController {
|
||||
require(msg.sender == controller, "Unauthorized");
|
||||
_;
|
||||
modifier onlyController {
|
||||
require(msg.sender == controller, "Unauthorized");
|
||||
_;
|
||||
}
|
||||
|
||||
address payable public controller;
|
||||
|
||||
constructor() internal {
|
||||
controller = msg.sender;
|
||||
constructor() internal {
|
||||
controller = msg.sender;
|
||||
}
|
||||
|
||||
/// @notice Changes the controller of the contract
|
||||
|
@ -1,10 +1,10 @@
|
||||
pragma solidity >=0.5.0 <0.6.0;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @notice Uses ethereum signed messages
|
||||
*/
|
||||
contract MessageSigned {
|
||||
|
||||
|
||||
constructor() internal {}
|
||||
|
||||
/**
|
||||
@ -13,12 +13,12 @@ contract MessageSigned {
|
||||
* @param _messageSignature message `_signHash` signature
|
||||
*/
|
||||
function recoverAddress(
|
||||
bytes32 _signHash,
|
||||
bytes32 _signHash,
|
||||
bytes memory _messageSignature
|
||||
)
|
||||
internal
|
||||
pure
|
||||
returns(address)
|
||||
returns(address)
|
||||
{
|
||||
uint8 v;
|
||||
bytes32 r;
|
||||
@ -48,7 +48,7 @@ contract MessageSigned {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev divides bytes signature into `uint8 v, bytes32 r, bytes32 s`
|
||||
* @dev divides bytes signature into `uint8 v, bytes32 r, bytes32 s`
|
||||
*/
|
||||
function signatureSplit(bytes memory _signature)
|
||||
internal
|
||||
@ -74,5 +74,5 @@ contract MessageSigned {
|
||||
}
|
||||
require(v == 27 || v == 28, "Bad signature version");
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -6,7 +6,7 @@ import "../token/ERC20Token.sol";
|
||||
import "../token/MiniMeToken.sol";
|
||||
/**
|
||||
* @title SNTController
|
||||
* @author Ricardo Guilherme Schmidt (Status Research & Development GmbH)
|
||||
* @author Ricardo Guilherme Schmidt (Status Research & Development GmbH)
|
||||
* @notice enables economic abstraction for SNT
|
||||
*/
|
||||
contract SNTController is TokenController, Owned {
|
||||
@ -27,7 +27,7 @@ contract SNTController is TokenController, Owned {
|
||||
}
|
||||
snt = _snt;
|
||||
}
|
||||
/**
|
||||
/**
|
||||
* @notice The owner of this contract can change the controller of the SNT token
|
||||
* Please, be sure that the owner is a trusted agent or 0x0 address.
|
||||
* @param _newController The address of the new controller
|
||||
@ -60,7 +60,7 @@ contract SNTController is TokenController, Owned {
|
||||
|
||||
/**
|
||||
* @notice payment by address coming from controlled token
|
||||
* @dev In between the offering and the network. Default settings for allowing token transfers.
|
||||
* @dev In between the offering and the network. Default settings for allowing token transfers.
|
||||
*/
|
||||
function proxyPayment(address) external payable returns (bool) {
|
||||
//Uncomment above line when using parameters
|
||||
@ -84,7 +84,7 @@ contract SNTController is TokenController, Owned {
|
||||
*/
|
||||
function onApprove(address, address, uint256) external returns (bool) {
|
||||
//Uncomment above line when using parameters
|
||||
//require(msg.sender == address(snt), "Unauthorized");
|
||||
//require(msg.sender == address(snt), "Unauthorized");
|
||||
return true;
|
||||
}
|
||||
}
|
@ -15,9 +15,9 @@ contract StatusNetwork is SNTController {
|
||||
constructor(
|
||||
address payable _owner,
|
||||
MiniMeToken _snt
|
||||
)
|
||||
public
|
||||
SNTController(_owner, _snt)
|
||||
)
|
||||
public
|
||||
SNTController(_owner, _snt)
|
||||
{ }
|
||||
|
||||
}
|
@ -3,7 +3,7 @@ pragma solidity >=0.5.0 <0.6.0;
|
||||
import "./StatusNetwork.sol";
|
||||
/**
|
||||
* @title SNTController
|
||||
* @author Ricardo Guilherme Schmidt (Status Research & Development GmbH)
|
||||
* @author Ricardo Guilherme Schmidt (Status Research & Development GmbH)
|
||||
* @notice Test net version of SNTController which allow public mint
|
||||
*/
|
||||
contract TestStatusNetwork is StatusNetwork {
|
||||
@ -15,19 +15,19 @@ contract TestStatusNetwork is StatusNetwork {
|
||||
* @param _owner Authority address
|
||||
* @param _snt SNT token
|
||||
*/
|
||||
constructor(address payable _owner, MiniMeToken _snt)
|
||||
public
|
||||
constructor(address payable _owner, MiniMeToken _snt)
|
||||
public
|
||||
StatusNetwork(_owner, _snt)
|
||||
{ }
|
||||
|
||||
function () external {
|
||||
_generateTokens(msg.sender, 1000 * (10 ** uint(snt.decimals())));
|
||||
}
|
||||
|
||||
|
||||
function mint(uint256 _amount) external {
|
||||
_generateTokens(msg.sender, _amount);
|
||||
}
|
||||
|
||||
|
||||
function generateTokens(address _who, uint _amount) external {
|
||||
_generateTokens(_who, _amount);
|
||||
}
|
||||
@ -48,8 +48,8 @@ contract TestStatusNetwork is StatusNetwork {
|
||||
} else {
|
||||
TestStatusNetwork(statusNetwork).generateTokens(_who, _amount);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -10,7 +10,7 @@ contract ERC20Receiver {
|
||||
mapping (address => mapping(address => uint256)) tokenBalances;
|
||||
|
||||
constructor() public {
|
||||
|
||||
|
||||
}
|
||||
|
||||
function depositToken(
|
||||
@ -22,7 +22,7 @@ contract ERC20Receiver {
|
||||
msg.sender,
|
||||
_token,
|
||||
_token.allowance(
|
||||
msg.sender,
|
||||
msg.sender,
|
||||
address(this)
|
||||
)
|
||||
);
|
||||
@ -32,7 +32,7 @@ contract ERC20Receiver {
|
||||
ERC20Token _token,
|
||||
uint256 _amount
|
||||
)
|
||||
external
|
||||
external
|
||||
{
|
||||
_withdrawToken(msg.sender, _token, _amount);
|
||||
}
|
||||
@ -40,7 +40,7 @@ contract ERC20Receiver {
|
||||
function depositToken(
|
||||
ERC20Token _token,
|
||||
uint256 _amount
|
||||
)
|
||||
)
|
||||
external
|
||||
{
|
||||
require(_token.allowance(msg.sender, address(this)) >= _amount, "Bad argument");
|
||||
@ -51,9 +51,9 @@ contract ERC20Receiver {
|
||||
ERC20Token _token,
|
||||
address _from
|
||||
)
|
||||
external
|
||||
view
|
||||
returns(uint256 fromTokenBalance)
|
||||
external
|
||||
view
|
||||
returns(uint256 fromTokenBalance)
|
||||
{
|
||||
return tokenBalances[address(_token)][_from];
|
||||
}
|
||||
@ -63,7 +63,7 @@ contract ERC20Receiver {
|
||||
ERC20Token _token,
|
||||
uint256 _amount
|
||||
)
|
||||
private
|
||||
private
|
||||
{
|
||||
require(_amount > 0, "Bad argument");
|
||||
if (_token.transferFrom(_from, address(this), _amount)) {
|
||||
@ -86,5 +86,5 @@ contract ERC20Receiver {
|
||||
emit TokenWithdrawn(address(_token), _from, _amount);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -9,20 +9,20 @@ contract StandardToken is ERC20Token {
|
||||
mapping (address => mapping (address => uint256)) allowed;
|
||||
|
||||
constructor() internal { }
|
||||
|
||||
|
||||
function transfer(
|
||||
address _to,
|
||||
uint256 _value
|
||||
)
|
||||
external
|
||||
)
|
||||
external
|
||||
returns (bool success)
|
||||
{
|
||||
return transfer(msg.sender, _to, _value);
|
||||
return transfer(msg.sender, _to, _value);
|
||||
}
|
||||
|
||||
function approve(address _spender, uint256 _value)
|
||||
function approve(address _spender, uint256 _value)
|
||||
external
|
||||
returns (bool success)
|
||||
returns (bool success)
|
||||
{
|
||||
allowed[msg.sender][_spender] = _value;
|
||||
emit Approval(msg.sender, _spender, _value);
|
||||
@ -38,35 +38,35 @@ contract StandardToken is ERC20Token {
|
||||
returns (bool success)
|
||||
{
|
||||
if (balances[_from] >= _value &&
|
||||
allowed[_from][msg.sender] >= _value &&
|
||||
allowed[_from][msg.sender] >= _value &&
|
||||
_value > 0) {
|
||||
allowed[_from][msg.sender] -= _value;
|
||||
return transfer(_from, _to, _value);
|
||||
} else {
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function allowance(address _owner, address _spender)
|
||||
external
|
||||
view
|
||||
function allowance(address _owner, address _spender)
|
||||
external
|
||||
view
|
||||
returns (uint256 remaining)
|
||||
{
|
||||
return allowed[_owner][_spender];
|
||||
}
|
||||
|
||||
function balanceOf(address _owner)
|
||||
external
|
||||
view
|
||||
returns (uint256 balance)
|
||||
function balanceOf(address _owner)
|
||||
external
|
||||
view
|
||||
returns (uint256 balance)
|
||||
{
|
||||
return balances[_owner];
|
||||
}
|
||||
|
||||
|
||||
function mint(
|
||||
address _to,
|
||||
uint256 _amount
|
||||
)
|
||||
)
|
||||
internal
|
||||
{
|
||||
balances[_to] += _amount;
|
||||
@ -75,11 +75,11 @@ contract StandardToken is ERC20Token {
|
||||
}
|
||||
|
||||
function transfer(
|
||||
address _from,
|
||||
address _from,
|
||||
address _to,
|
||||
uint256 _value
|
||||
)
|
||||
internal
|
||||
internal
|
||||
returns (bool success)
|
||||
{
|
||||
if (balances[_from] >= _value && _value > 0) {
|
||||
@ -87,8 +87,8 @@ contract StandardToken is ERC20Token {
|
||||
balances[_to] += _value;
|
||||
emit Transfer(_from, _to, _value);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,11 +6,11 @@ import "./StandardToken.sol";
|
||||
* @notice ERC20Token for test scripts, can be minted by anyone.
|
||||
*/
|
||||
contract TestToken is StandardToken {
|
||||
|
||||
|
||||
constructor() public { }
|
||||
|
||||
/**
|
||||
* @notice any caller can mint any `_amount`
|
||||
* @notice any caller can mint any `_amount`
|
||||
* @param _amount how much to be minted
|
||||
*/
|
||||
function mint(uint256 _amount) public {
|
||||
|
@ -3,7 +3,8 @@
|
||||
"app": {
|
||||
"js/dapp.js": ["app/dapp.js"],
|
||||
"index.html": "app/index.html",
|
||||
"images/": ["app/images/**"]
|
||||
"images/": ["app/images/**"],
|
||||
"css/bootstrap.min.css": "node_modules/bootstrap/dist/css/bootstrap.min.css"
|
||||
},
|
||||
"buildDir": "dist/",
|
||||
"config": "config/",
|
||||
|
Loading…
x
Reference in New Issue
Block a user