Behind YGG's massive guild economy, supporting the efficient circulation of assets worth over tens of millions of dollars, is no longer the early 'manual multi-signature + spreadsheet management', but a Vault contract system gradually aligning with the ERC-4626 tokenized treasury standard.

YGG is upgrading the original concept of the 'Guild Treasury' into a composable, reusable, and auditable on-chain asset management infrastructure:

  • Users only see a simple 'Deposit / Stake' entry point,

  • but internally, the contract completes a full loop of asset routing, strategy execution, yield buyback, and automatic distribution.

First, core architecture: from 'a large pool' to 'core + strategy' asset routing

Traditional guild vaults are often a huge funding pool where all assets are piled up in the same contract, leading to clear single-point risks in both security and scalability.

YGG has adopted a 'core layer + strategy layer' splitting approach in the new generation of Vault architecture:

  • Vault Core (Core Layer)

    • Responsible for handling basic vault operations like deposit / mint / withdraw / redeem;

    • Maintains Total Assets / Total Shares and calculates share prices;

    • Does not directly call external protocols, leaving as much 'hands-on operation' of funds to the strategy layer as possible.

  • Strategy Adapters (Strategy Adapters)

    • Each Adapter corresponds to a specific source of yield (such as Ronin Staking, lending protocols, NFT leasing strategies, etc.);

    • Vault Core allocates assets to different Adapters through the Router;

    • The strategy layer interacts with external DeFi / nodes / NFT logic, bearing the responsibility of yield generation and strategic risk.

  • Harvester (Automated Harvester)

    • Called periodically by Keeper / Bot to harvest();

    • Responsible for recycling and converting the reward assets generated by the strategy layer (such as RON, AXS, etc.) into target assets (such as YGG or USDC) and injecting them into Vault Core;

    • Completes 'automatic reinvestment' and yield backflow for users.

The key point of this split is:

  • Users only interact with Vault Core;

  • The strategy layer is pluggable and replaceable, and a problem with a single strategy will not directly affect the entire vault ledger;

  • The Harvester automates the complex actions of 'selling rewards, repurchasing, and reinvesting,' making the yield experience closer to traditional fund products.

Second, ERC-4626: YGG makes Vault 'standardized assets'

YGG chooses to be compatible with ERC-4626, essentially labeling the Vault with a 'standard interface' tag, allowing vault assets to enter a larger DeFi puzzle.

1) Unified interface for easy integration with other protocols

ERC-4626 specifies several key functions:

  • deposit() / withdraw(): with base assets as input / output;

  • mint() / redeem(): with vault Shares as input / output;

  • convertToShares() / convertToAssets(): to convert between assets and shares.

This way, other protocols (lending markets, leveraged strategies, yield aggregators) can recognize and integrate YGG Vault in a unified way without having to write a set of custom logic for each vault.

2) Use 'share price' to carry yield

YGG Vault adopts a typical 'share appreciation' model:

Share Price = Total Assets / Total Shares

In simple terms:

  • When users deposit YGG / USDC, Vault Core gives the corresponding number of Shares;

  • When the Harvester converts external yield assets (such as 1000 RON) into vault-valued assets and injects them:

    • Total Assets increase;

    • Total Shares remain unchanged;

    • The result is that Share Price increases.

When users exit, they do not receive a string of 'reward tokens', but rather exchange their Shares for more base assets:
The number of shares remains unchanged, and the 'value' of each increases.

This model has three benefits:

  • Yield is automatically reinvested without the need for frequent claims;

  • Other protocols only need to focus on the TotalAssets / TotalSupply metrics when integrating;

  • For users, the asset experience is close to that of a 'net asset value fund.'

Three, yield distribution logic: RewardDistributor's 'two sets of ledgers'

In addition to the coin-based appreciation of the vault itself, YGG has also layered an additional reward distribution contract on top of some Vaults (for example, distributing a certain SubDAO token).

This is usually accomplished by a contract similar to RewardDistributor, which has two very critical states internally:

  • stakedBalance: records the effective staking shares of each address in the reward contract;

  • rewardIndex / rewardPerToken: records the rewards accumulated per unit of staked shares from the start to the current time.

To save Gas, YGG adopts the 'lazy update' approach:

  • Contracts do not settle rewards for everyone in every block;

  • But when users interact (deposit, withdraw, claim rewards),
    Perform an O(1) level calculation with the current global rewardPerToken() metric and the last recorded one.

Similar to the following logic:

function earned(address account) public view returns (uint256) {
return (balanceOf(account) * (rewardPerToken() - userRewardPerTokenPaid[account])) / 1e18
+ rewards[account];
}

For YGG, the effect of this design is:

  • Even with thousands of staking addresses, the computation for each settlement by the contract remains constant;

  • The fairness of reward distribution is guaranteed by mathematics, rather than relying on manual snapshots or offline reconciliations;

  • Additional rewards can be flexibly stacked on top of Vault Shares without disrupting the basic logic of ERC-4626.

Four, security design: How YGG Vault prevents being 'exploited'

The YGG Vault carries funds on the scale of tens of millions or even higher, and safety protection must be directly written into the contract, rather than staying at the level of 'do no evil' verbal commitments.

Typical defensive measures include:

1) Prevent flash loan manipulation of Share Price

In a vault without protection, flash loan attackers can:

  1. Use huge flash loans to briefly amplify the assets of a certain funding pool within a block;

  2. Utilize short-term distortions in prices / shares to complete arbitrage operations;

  3. Repay flash loans in the same block, leaving the risk to the vault.

YGG reduces this type of risk in the following ways:

  • Add same block restrictions or minimum holding times on deposits and withdrawals;

  • Introduce time-weighted prices / shares in key calculations to avoid extreme fluctuations within a single block affecting the long-term state.

2) Oracles and slippage protection

When the Harvester needs to convert strategy rewards into vault assets (e.g., RON → YGG), YGG will:

  • Using trusted oracles (like Chainlink) as price benchmarks;

  • Setting maximum slippage tolerances during trading, such as reverting if the deviation from the oracle price exceeds 1%;

  • Reducing losses due to low liquidity or MEV attacks (Sandwich).

The purpose of this set of combined punches is only one:
While pursuing yield, compress the time window and space exposed to attack of the contract itself as much as possible.

Five, from 'Guild Vault' to 'On-chain Asset Management Infrastructure'

From a technical perspective, YGG Vault has far exceeded the scope of 'a Stake button':

  • From the perspective of asset form:
    Vault Shares under the ERC-4626 standard can already be recognized by other protocols as collateralizable and reusable 'vault assets'.

  • From the perspective of architectural design:
    The split of 'core + strategy + Harvester' allows YGG to continuously iterate and expand strategy combinations without compromising ledger security.

  • From the perspective of yield model:
    Share Price appreciation + extended rewards from RewardDistributor,
    allowing YGG to flexibly design incentive structures for different SubDAOs, different games, and different assets.

For holders and participants focused on YGG, understanding the technical details of the Vault is actually about understanding one thing:

YGG is not just a 'guild that helps players earn money',
YGG is transforming itself into a standardized, composable on-chain asset management infrastructure,
Vault is the core carrying layer of this infrastructure.

I am the analyst who looks at the essence without pursuing noise.