uniswap / governance Goto Github PK
View Code? Open in Web Editor NEW๐ Governance contracts for the Uniswap protocol
Home Page: https://uniswap.org
๐ Governance contracts for the Uniswap protocol
Home Page: https://uniswap.org
Could you please give me some information?
function _moveDelegates(address srcRep, address dstRep, uint96 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint96 srcRepNew = sub96(srcRepOld, amount, "Uni::_moveVotes: vote amount underflows");
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
uint32 dstRepNum = numCheckpoints[dstRep];
uint96 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint96 dstRepNew = add96(dstRepOld, amount, "Uni::_moveVotes: vote amount overflows");
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
Here the vote of the recipient in the transfer function is reset.
When I run the moveDelegates function within the transfer function in my contract, the votes of the spender account are deducted, but the votes of the recipient account are reset. So what's going on is the vote. Why do you think it might? Can you help me?
1.deploy and call propose is ok
const governorAlpha = await deployContract(wallet, json, [timelockAddress, uniAddress])
const proposalId = await governorAlpha.callStatic.propose([target], [value], [signature], [calldata], description)
2.but my governor contract is published,common method is ok,but i want to test propose is always wrong,how to do it?
let json = require('/Users/xj/code/defi/governance/build/GovernorAlpha.json')
const abi = json.abi
const governorAddress = "0x5e4be8Bc9637f0EAA1A755019e06A68ce081D58F"//GOVERNANCE_ADDRESS
const governorContract = new Contract(governorAddress, abi, wallet)
//this code is always fail. err: { Error: failed to meet quorum (method="call",... reason: 'failed to meet quorum',
const proposalId = await governorContract.callStatic.propose([target], [value], [signature], [calldata], description)
//or call direct is same error . err: { Error: failed to meet quorum (method="call",... reason: 'failed to meet quorum',
let proposalId2 = await governorContract.propose([target], [value], [signature], [calldata], description)
console.log("proposalId:",proposalId2.toString())
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.