This file contains hidden or 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
/* Globals */ | |
a,a:focus,a:hover{color:#fff;} | |
html,body{height:100%;text-align:center;background-color:#191b22;} | |
body{color:#fff} | |
.hide{display:none;} | |
.landing-heading{font-family:'Lato',Sans-Serif;font-weight:400;} | |
/* Buttons */ | |
.btn{font-family:'Lato',Sans-Serif;padding:0.5625rem 2.5rem;font-size:0.8125rem;font-weight:400;line-height:1.75rem;border-radius:0!important;-webkit-transition:all .2s ease-in-out;-moz-transition:all .2s ease-in-out;-ms-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;} | |
.btn-lg{font-size:1.5rem;padding:0.6875rem 3.4375rem;line-height:2.5rem;} |
This file contains hidden or 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
render() { | |
const { handleSignOut } = this.props; | |
const { person } = this.state; | |
const { username } = this.state; | |
return ( | |
!isSignInPending() && person ? | |
<div className="container"> | |
<div className="row"> | |
<div className="col-md-offset-3 col-md-6"> |
This file contains hidden or 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
/// A runtime module template with necessary imports | |
/// Feel free to remove or edit this file as needed. | |
/// If you change the name of this file, make sure to update its references in runtime/src/lib.rs | |
/// If you remove this file, you can remove those references | |
/// For more guidance on Substrate modules, see the example module | |
/// https://github.com/paritytech/substrate/blob/master/srml/example/src/lib.rs | |
use rstd::prelude::*; | |
use support::{decl_module, decl_storage, decl_event, dispatch::Result, StorageValue, StorageMap, ensure}; |
This file contains hidden or 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
/// runtime module implementing the ERC20 token interface | |
/// with added lock and unlock functions for staking in TCR runtime | |
/// implements a custom type `TokenBalance` for representing account balance | |
/// `TokenBalance` type is exactly the same as the `Balance` type in `balances` SRML module | |
use rstd::prelude::*; | |
use parity_codec::Codec; | |
use support::{dispatch::Result, StorageMap, Parameter, StorageValue, decl_storage, decl_module, decl_event, ensure}; | |
use system::{self, ensure_signed}; | |
use runtime_primitives::traits::{CheckedSub, CheckedAdd, Member, SimpleArithmetic, As}; |
This file contains hidden or 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
/** | |
* @notice Commits vote using hash of choice and secret salt to conceal vote until reveal | |
* @param _pollID Integer identifier associated with target poll | |
* @param _secretHash Commit keccak256 hash of voter's choice and salt | |
* @param _numTokens The number of tokens to be commited towards the target poll | |
* @param _prevPollID The ID of the poll that the user has voted the maximum number of | |
* tokens in which is still less than or equal to numTokens | |
*/ | |
// To commit a user must hold enough voting rights | |
require(voteTokenBalance[msg.sender] >= _numTokens, "Cannot commit because of shortage of ERC20 tokens"); |
This file contains hidden or 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
/** | |
* @notice Loads _numTokens ERC20 tokens into the voting contract for one-to-one voting rights | |
* @dev Assumes that msg.sender has approved voting contract to spend on their behalf | |
* @param _numTokens The number of votingTokens desired in exchange for ERC20 tokens | |
*/ | |
function requestVotingRights(uint256 _numTokens) public { | |
require(token.balanceOf(msg.sender) >= _numTokens, "Cannot stake more than you have"); | |
voteTokenBalance[msg.sender] = voteTokenBalance[msg.sender].add(_numTokens); | |
// Transfer tokens to voting contract |
This file contains hidden or 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
var MetaCoin = artifacts.require("./MetaCoin.sol"); | |
contract('MetaCoin', function(accounts) { | |
describe('Token', function() { | |
it("should put 10000 MetaCoin in the first account", function() { | |
return MetaCoin.deployed().then(function(instance) { | |
return instance.getBalance.call(accounts[0]); | |
}).then(function(balance) { | |
assert.equal(balance.valueOf(), 10000, "10000 wasn't in the first account"); | |
}); |
This file contains hidden or 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
var MetaCoin = artifacts.require("./MetaCoin.sol"); | |
contract('MetaCoin', (accounts) => { | |
describe('Token', () => { | |
it("should put 10000 MetaCoin in the first account", async () => { | |
let instance = await MetaCoin.deployed(); | |
let alice = accounts[0]; | |
let balance = await instance.getBalance.call(alice); | |
assert.equal(balance.valueOf(), 10000, "10000 wasn't in the first account"); | |
}); |
This file contains hidden or 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
var MetaCoin = artifacts.require("./MetaCoin.sol"); | |
contract('MetaCoin', (accounts) => { | |
describe('Token', () => { | |
let balance; | |
let instance; | |
const [alice, bob] = accounts; | |
before(async () => { | |
instance = await MetaCoin.deployed(); |
This file contains hidden or 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
const MetaCoin = artifacts.require("./MetaCoin.sol"); | |
const utils = require('./utils.js'); | |
contract('MetaCoin', (accounts) => { | |
describe('Token', () => { | |
let balance; | |
let instance; | |
const [alice, bob] = accounts; | |
before(async () => { |