From 0105e704f92b75cf42a4d32bbf77c43ba4e85750 Mon Sep 17 00:00:00 2001 From: Barry Gitarts Date: Fri, 4 Jan 2019 15:31:31 -0500 Subject: [PATCH] add updated rinkeby contract + SNT Rinkeby --- app/utils/currencies.js | 3 +- config/contracts.js | 42 ++++++----- contracts/test/SNT.sol | 151 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 176 insertions(+), 20 deletions(-) create mode 100644 contracts/test/SNT.sol diff --git a/app/utils/currencies.js b/app/utils/currencies.js index 71f2759..2258276 100644 --- a/app/utils/currencies.js +++ b/app/utils/currencies.js @@ -1,4 +1,5 @@ import StandardToken from 'Embark/contracts/StandardToken' +import SNT from 'Embark/contracts/SNT' export const TOKEN_ICON_API = 'https://raw.githubusercontent.com/TrustWallet/tokens/master/images' export const TOKEN_COIN_API = 'https://raw.githubusercontent.com/TrustWallet/tokens/master/coins' @@ -9,7 +10,7 @@ export const currencies = [ img: `${TOKEN_COIN_API}/60.png`, }, { - value: '0x744d70fdbe2ba4cf95131626614a1763df805b9e', + value: SNT._address, label: 'Status (SNT)', }, { diff --git a/config/contracts.js b/config/contracts.js index 88b4aab..7968a40 100644 --- a/config/contracts.js +++ b/config/contracts.js @@ -112,6 +112,7 @@ module.exports = { testnet: {}, rinkeby: { + enabled: true, dappConnection: [ '$WEB3', // uses pre existing web3 object if available (e.g in Mist) 'ws://localhost:8546', @@ -120,36 +121,39 @@ module.exports = { strategy: 'explicit', contracts: { LPVault: { - address: "0x6732c6Cd8DA14C7E065b51689410058815657427", + address: "0xa25AB823c5A79941a8a9d0ab525D888cA1513419" }, LiquidPledging: { - address: "0x314159265dd8dbb310642f98f50c066173c1259b" + address: "0x07E92635AF5e524C20B20F2770aE0E0Ef597eD07" }, RecoveryVault: { - address: "0xeF6daB6A9b17379DBaAF4d6d54C96F8Bf3c945e5" + address: "0x835c1ab7CB9f0545164D7fE9827C5e43E3476809" }, LPFactory: { - address: "0x4d3d8aB9b20B6D95215Bc7Df0426c9DFcB0D61fb" - // args: { - // _vaultBase: '$LPVault', - // _lpBase: '$LiquidPledging', - }, + address: "0x968F0a788F29b5B33296C61cEB34F1c40C55e52c", + args: { + _vaultBase: '$LPVault', + _lpBase: '$LiquidPledging', + } }, // contracts for testing - StandardToken: { - address: "0x6732c6Cd8DA14C7E065b51689410058815657427" - }, - Kernel: { - address: "0x31CE00C0F0126cff08E91A83271f4e1a3624Fa6A", - file: "@aragon/os/contracts/kernel/Kernel.sol" + StandardToken: { + address: "0x6732c6Cd8DA14C7E065b51689410058815657427" }, - ACL: { - address: "0x74dDdbaFD8001Ae38971c23c6dc250A82aD37552", - file: "@aragon/os/contracts/acl/ACL.sol" + SNT: { + // minting address: 0xEdEB948dE35C6ac414359f97329fc0b4be70d3f1 + address: "0x43d5adC3B49130A575ae6e4b00dFa4BC55C71621" + }, + Kernel: { + address: "0x6Fc67b94c1431EC423D6598b092F2a8bCcD4e698", + file: "@aragon/os/contracts/kernel/Kernel.sol" + }, + ACL: { + address: "0xEb14c564dfA6ac88d28087138Dde59c8888bF928", + file: "@aragon/os/contracts/acl/ACL.sol" } } }, - // merges with the settings in default // used with "embark run livenet" livenet: {}, @@ -158,4 +162,4 @@ module.exports = { // "embark run custom_name" or "embark blockchain custom_name" //custom_name: { //} -}; +} diff --git a/contracts/test/SNT.sol b/contracts/test/SNT.sol new file mode 100644 index 0000000..285e50c --- /dev/null +++ b/contracts/test/SNT.sol @@ -0,0 +1,151 @@ +pragma solidity ^0.4.18; + +/** + * WARNING: This token is for testing purposes only + * and has been modified from the original version: https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/ERC20/StandardToken.sol + * + * @title Standard ERC20 token + * + * @dev Implementation of the basic standard token. + * @dev https://github.com/ethereum/EIPs/issues/20 + * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol + */ +contract SNT { + + event Transfer(address indexed from, address indexed to, uint256 value); + event Approval(address indexed owner, address indexed spender, uint256 value); + + mapping (address => mapping (address => uint256)) internal allowed; + mapping(address => uint256) balances; + + uint256 totalSupply_; + address owner; + + function SNT() public { + owner = msg.sender; + } + + modifier onlyOwner() { + require(msg.sender == owner); + _; + } + + /** + * @dev total number of tokens in existence + */ + function totalSupply() public view returns (uint256) { + return totalSupply_; + } + + function mint(address _to, uint _value) public onlyOwner { + totalSupply_ += _value; + balances[_to] += _value; + Transfer(0, _to, _value); + } + + /** + * @dev transfer token for a specified address + * @param _to The address to transfer to. + * @param _value The amount to be transferred. + */ + function transfer(address _to, uint256 _value) public returns (bool) { + require(_to != address(0)); + require(_value <= balances[msg.sender]); + + // SafeMath.sub will throw if there is not enough balance. + balances[msg.sender] = balances[msg.sender] - _value; + balances[_to] = balances[_to] + _value; + Transfer(msg.sender, _to, _value); + return true; + } + + /** + * @dev Gets the balance of the specified address. + * @param _owner The address to query the the balance of. + * @return An uint256 representing the amount owned by the passed address. + */ + function balanceOf(address _owner) public view returns (uint256 balance) { + return balances[_owner]; + } + /** + * @dev Transfer tokens from one address to another + * @param _from address The address which you want to send tokens from + * @param _to address The address which you want to transfer to + * @param _value uint256 the amount of tokens to be transferred + */ + function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { + require(_to != address(0)); + require(_value <= balances[_from]); + require(_value <= allowed[_from][msg.sender]); + + balances[_from] = balances[_from] - _value; + balances[_to] = balances[_to] + _value; + allowed[_from][msg.sender] = allowed[_from][msg.sender] - _value; + Transfer(_from, _to, _value); + return true; + } + + /** + * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. + * + * Beware that changing an allowance with this method brings the risk that someone may use both the old + * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this + * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: + * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 + * @param _spender The address which will spend the funds. + * @param _value The amount of tokens to be spent. + */ + function approve(address _spender, uint256 _value) public returns (bool) { + allowed[msg.sender][_spender] = _value; + Approval(msg.sender, _spender, _value); + return true; + } + + /** + * @dev Function to check the amount of tokens that an owner allowed to a spender. + * @param _owner address The address which owns the funds. + * @param _spender address The address which will spend the funds. + * @return A uint256 specifying the amount of tokens still available for the spender. + */ + function allowance(address _owner, address _spender) public view returns (uint256) { + return allowed[_owner][_spender]; + } + + /** + * @dev Increase the amount of tokens that an owner allowed to a spender. + * + * approve should be called when allowed[_spender] == 0. To increment + * allowed value is better to use this function to avoid 2 calls (and wait until + * the first transaction is mined) + * From MonolithDAO Token.sol + * @param _spender The address which will spend the funds. + * @param _addedValue The amount of tokens to increase the allowance by. + */ + function increaseApproval(address _spender, uint _addedValue) public returns (bool) { + allowed[msg.sender][_spender] = allowed[msg.sender][_spender] + _addedValue; + Approval(msg.sender, _spender, allowed[msg.sender][_spender]); + return true; + } + + /** + * @dev Decrease the amount of tokens that an owner allowed to a spender. + * + * approve should be called when allowed[_spender] == 0. To decrement + * allowed value is better to use this function to avoid 2 calls (and wait until + * the first transaction is mined) + * From MonolithDAO Token.sol + * @param _spender The address which will spend the funds. + * @param _subtractedValue The amount of tokens to decrease the allowance by. + */ + function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { + uint oldValue = allowed[msg.sender][_spender]; + if (_subtractedValue > oldValue) { + allowed[msg.sender][_spender] = 0; + } else { + allowed[msg.sender][_spender] = oldValue - _subtractedValue; + } + Approval(msg.sender, _spender, allowed[msg.sender][_spender]); + return true; + } + +}