I hereby claim:
- I am atvanguard on github.
- I am atvanguard (https://keybase.io/atvanguard) on keybase.
- I have a public key whose fingerprint is CEDE F950 D9C8 4A61 FFCE 1568 6F43 0E10 16B8 5EA2
To claim this, I am signing this object:
const LiquidDemocracy = artifacts.require("LiquidDemocracy"); | |
contract('LiquidDemocracy', function(accounts) { | |
it('propose-vote-delegate-2', async function() { | |
let instance = await LiquidDemocracy.deployed(); | |
let txs = [ | |
instance.newProposal('proposal 0'), | |
instance.newProposal('proposal 1'), | |
instance.newProposal('proposal 2') | |
]; |
event Winner(int proposal, int votes); | |
function findWinningProposal() public returns(int, int) { | |
uint numVoters = validVoters.length; | |
bool[] memory visited = new bool[](numVoters); | |
int maxVotes = -1; | |
int winningProposal = -1; | |
// loop through the validVoters array | |
for (uint i = 0; i < numVoters; i++) { |
function vote(uint proposal) public isValidVoter { | |
require( | |
proposal < proposals.length, | |
'Invalid proposal id' | |
); | |
Voter storage voter = voters[msg.sender]; | |
voter.vote = proposal; | |
voter.state = State.Voted; | |
} |
// delegations | |
await instance.delegateTo(accounts[2], {from: accounts[3]}) | |
await instance.delegateTo(accounts[5], {from: accounts[6]}) | |
await instance.delegateTo(accounts[7], {from: accounts[8]}) | |
// V7 delegates to V5 creating a super proxy | |
await instance.delegateTo(accounts[5], {from: accounts[7]}) | |
// V5 delegates their combined voting power to V4 | |
await instance.delegateTo(accounts[4], {from: accounts[5]}) |
contract LiquidDemocracy { | |
... | |
function delegateTo(address delegate) public isValidVoter { | |
require( | |
voters[delegate].state != State.Invalid, | |
'Delegating to invalid voter' | |
); | |
require( | |
delegate != msg.sender && !delegationCycleExists(delegate, msg.sender), |
const LiquidDemocracy = artifacts.require("LiquidDemocracy"); | |
contract('LiquidDemocracy', function(accounts) { | |
it('propose-vote-delegate', async function() { | |
let instance = await LiquidDemocracy.deployed(); | |
let txs = [ | |
instance.newProposal('proposal 0'), | |
instance.newProposal('proposal 1'), | |
instance.newProposal('proposal 2') | |
]; |
contract LiquidDemocracy { | |
enum State {Invalid, Created, Voted, Delegated} | |
struct Proposal { | |
string description; | |
uint numVotes; | |
} | |
Proposal[] public proposals; | |
address[] validVoters; |
I hereby claim:
To claim this, I am signing this object:
api_logs=# \d+ logs | |
Table "public.logs" | |
Column | Type | Modifiers | Storage | Stats target | Description | |
------------+-----------------------------+---------------+----------+--------------+------------- | |
id | bigint | not null | plain | | | |
api_key | character varying | not null | extended | | | |
statuscode | integer | | plain | | | |
latency | integer | | plain | | | |
method | character varying | | extended | | | |
created_at | timestamp without time zone | default now() | plain | | |
import { Client } from 'pg'; | |
const copyTo = require('pg-copy-streams').to; | |
const copyFrom = require('pg-copy-streams').from; | |
const fromDb = new Client({ | |
host: 'oldDb.rds.amazonaws.com', | |
user: 'username', | |
password: 'password', | |
database: 'api_logs' | |
}); |