protocol-solidity
protocol-solidity copied to clipboard
Token Ownership/Approval/Minting Rights in the VAnchor
Flow for ERC20s
- Unwrapped ERC20 token is deposited via the
wrapAndDepositERC20function on theMultiAssetVAnchor.solcontract. - The
wrapAndDepositERC20function takes in thefromTokenAddresswhich is the address of the unwrapped ERC20 contract and thetoTokenAddresswhich is the address of the wrapped ERC20 contract. - This calls the
wrapForAndSendTomethod on theTokenWrapper.solcontract. The unwrapped ERC20 tokens being deposited are transferred to theFungibleTokenWrapperand wrapped ERC20 tokens are minted to theMultiAssetVAnchor.
In the diagram below a -> b means a is owned by b.

Security, etc.
- If minting right of
ERC20PresetMinterPauseris not properly tranferred...the deployer of theFungibleTokenWrappercan mint infinite wrapped tokens to themselves. Solution: Need to transfer minting rights to theMultiAssetVAnchor.
Approvals
It is possible for an ERC20 token owner, Alice, to approve a spender, Bob, to spend a certain number of tokens (known as the allowance) on her behalf. In the Webb private asset transfer system, this pattern is used in the following places:
- When a user deposits unwrapped ERC20 tokens, they don't directly
transferthe tokens to theFungibleTokenWrapper. Rather each user mustapprovetheFungibleTokenWrapperto be able to spend the unwrapped ERC20 tokens on their behalf. So something like this is not quite right. - In the scenario, in which the user
deposits already wrapped tokens, the user needs toapprovetheVAnchorto spend wrapped tokens.