VELOCORE V2
V1 DocszkSyncEraLineaTelos
  • Introduction
  • Our Philosophy
    • Vision
    • Gas Optimization
    • General Bedrock for All Kinds of AMM
    • Epoch-less Predictability
    • Free Flowing Easy Vote System
  • DEX Innovation
    • Token Vault
      • Flashloan
    • Gas Saving Matters : Benchmark
    • AMM Flexibility
    • Multi In/Out Swap
    • Batch Swap
    • Adjustable Trading Fee Mechanics
    • Accumulating Swap Fees in LP Tokens
  • ve(3,3) Innovation
    • Removing 'Epoch' Systems
      • Bribe Optimization
    • Fungible Votes ($veVC)
      • No Decay & Easy Liquidation
    • Decentralized Gauge Deployment
    • Rebase Elimination
  • Security & Contract Address
    • zkSyncEra Contracts
    • Linea Contracts
    • Telos Contracts
    • V1 zkSyncEra (deprecated)
    • Three Rounds of Audits
  • Technical Docs
    • Concepts
    • Architecture Overview
      • Source Files Overview
    • How to interact with VELOCORE
      • Uniswap compatible interface
    • How to Read Data
    • Example Codes
      • Swap
      • Add liquidity
      • Stake
      • Voting
      • Multicall operations
      • cf) wrapper functions
    • Typescript Examples for Integration
    • Pool Specifics
      • Generalized CPMM
      • Wombat Stableswap
    • Events & Chart Integration
      • Getting a pair list
      • Interpreting Swap / LP events
    • Flashloan
  • zkSync Era
    • Migration Plan
      • $VC 1:1 Exchange
      • veNFT -> $veVC
      • One-Step LP Migration
      • Migration Schedule
      • Emission Migration
    • V2 Tokenomics
      • $VC Gauge
      • Bribe Mechanics
      • $veVC VOTING
    • Paymaster as a Service
  • Linea
    • Launch Details
      • Getting Ready
      • Bridging
      • V2 Launch Event
      • $LVC Presale
    • $LVC Tokenomics
      • $LVC Gauge
      • Bribe Mechanics
      • $veLVC VOTING
  • Telos
    • Launch Details
      • Getting Ready
      • Bridging
      • Launch Event
    • $TVC Tokenomics
      • $TVC Gauge
      • Bribe Mechanics
      • $veTVC VOTING
  • Free Loot Box for Future Airdrops
  • PASSPORT - F'air drops
  • Legal Disclaimer
  • Velocore Brand Assets
Powered by GitBook
On this page
  1. Technical Docs
  2. Example Codes

Voting

Vote/Unvote

  • Token : vevc

  • op type : Vote(0x03)

  • Interacting pool = gauge address

Vote interacts with gauge. Gauge is same with pool address for volatile pairs. Check Staketo know how to get stable pool's gauge address.

Use positive amount to vote and negetive amount to unvote.

// you vote with vevc token which is ERC20 not ERC721
Token[] memory tokens = new Token[](1);
tokens[0] = toToken(IERC20(vevc));

VelocoreOperation[] memory ops = new VelocoreOperation[](1);
// Vote interacts with gauge. Gauge is same with pool for volatile pairs.
// Check Stake section of the docs to find out way to get stablepool's gauge address.
int128 voteAmount = int128(int256(IERC20(vevc).balanceOf(address(this))));
ops[0].poolId = toPoolId(VOTE,usdc_eth_pool);
ops[0].tokenInformations = new bytes32[](1);
//Vote : positive flow in gauge's perspective. Unvote : negative flow. so just put - in the amount to unvote.
ops[0].tokenInformations[0] = toTokenInfo(0x00,EXACTLY,voteAmount);        
ops[0].data = "";
return execute(tokens, new int128[](1), ops);

Harvesting vote reward

If the gauge has already been voted on, there will be a voting reward to claim.

In this case, you'll also need to send additional tokenInfo in the Op to claim it. If you don't, it will be credited to your internal balance and you can claim it later by performing a separate claim operation.

  • Token : Since voting rewards are accumulated in the LP itself, you need to include the pool LP address.

  • opType : VOTE(0x03)

  • Interacting pool : gauge address

  • use AT_MOST 0 for amount since you are receiving.

// Same as vote. just lp token is added on the operation. 
// If you are not changing the vote, just send lp token operation without vevc.
Token[] memory tokens = new Token[](2);
tokens[0] = toToken(IERC20(vevc));
tokens[1] = toToken(IERC20(usdc_eth_pool));

VelocoreOperation[] memory ops = new VelocoreOperation[](1);
int128 voteAmount = int128(int256(IERC20(vevc).balanceOf(address(this))));
ops[0].poolId = toPoolId(VOTE,usdc_eth_pool);
// this part is added. send 2 tokenInformation instead of 1.
ops[0].tokenInformations = new bytes32[](2);
ops[0].tokenInformations[0] = toTokenInfo(0x00,EXACTLY,voteAmount); 
// Since you don't know how many tokens you will claim, but you are sure that you are receiving, not giving, 
// so use AT_MOST 0 for the LP token amount.
ops[0].tokenInformations[1] = toTokenInfo(0x01,AT_MOST,0);        
ops[0].data = "";

return execute(tokens, new int128[](1), ops);

Last updated 1 year ago