VotingEscrow & VeToken (BARK)
- VotingEscrow:
0x19cDA4B6EEb4AB71033Ef926c9ee096Af25E8bdd - VeToken (BARK):
0x776347AF16E01BE5CdC028b556bE029C156024a2
VeToken is the BARK ERC-20. VotingEscrow locks BARK into a non-fungible veNFT whose voting
power decays linearly to zero at the lock's expiry. Source:
bark_contracts/ve3/contracts/VotingEscrow.sol (byte-identical to THENA upstream).
Locking
| Function | Description |
|---|---|
create_lock(uint256 _value, uint256 _lock_duration) → uint256 tokenId | Lock _value BARK for _lock_duration seconds; mints a veNFT. |
create_lock_for(uint256 _value, uint256 _lock_duration, address _to) → uint256 | Lock on behalf of another address. |
increase_amount(uint256 _tokenId, uint256 _value) | Add BARK to an existing lock. |
increase_unlock_time(uint256 _tokenId, uint256 _lock_duration) | Extend the lock duration. |
withdraw(uint256 _tokenId) | Withdraw BARK after the lock has expired. |
merge(uint256 _from, uint256 _to) | Merge two veNFTs. |
Maximum lock is two years; longer locks confer proportionally more voting power.
Reading voting power
| Function | Description |
|---|---|
balanceOfNFT(uint256 _tokenId) → uint256 | Current voting power of a veNFT. |
balanceOfNFTAt(uint256 _tokenId, uint256 _t) → uint256 | Voting power at timestamp _t. |
totalSupply() → uint256 | Aggregate voting power across all veNFTs. |
locked(uint256 _tokenId) → (int128 amount, uint256 end) | Locked BARK amount and unlock time. |
ownerOf(uint256 _tokenId) → address | veNFT owner (standard ERC-721). |
Key events
Deposit(address indexed provider, uint256 tokenId, uint256 value, uint256 indexed locktime, uint8 deposit_type, uint256 ts)Withdraw(address indexed provider, uint256 tokenId, uint256 value, uint256 ts)Transfer(address indexed from, address indexed to, uint256 indexed tokenId)
The Deposit event carries the new tokenId — read it from the receipt after create_lock.