SmartWalletChecker
The SmartWalletChecker is an external contract that checks if certain smart contracts are approved to lock CRV tokens into the VotingEscrow. Permission can be granted via the approveWallet
and revoked via revokeWallet
methods.
Contract Source & Deployment
SmartWalletChecker contract is deployed to the Ethereum mainnet at: 0xca719728Ef172d0961768581fdF35CB116e0B7a4.
This contract can be replaced in its entirety with a new SmartWalletChecker through the VotingEscrow's commit_smart_wallet_checker
function.
Once this happens, the previously approved smart contracts will not be able to create a new lock, extend the lock duration, or add more CRV to the already existing lock if the new SmartWalletChecker
does not approve them again. This is because all those methods (create_lock
, increase_unlock_time
, and increase_amount
) check if the caller is approved via the internal assert_not_contract
function.
VotingEscrow: Internal assert_not_contract
function
@internal
def assert_not_contract(addr: address):
"""
@notice Check if the call is from a whitelisted smart contract, revert if not
@param addr Address to be checked
"""
if addr != tx.origin:
checker: address = self.smart_wallet_checker
if checker != ZERO_ADDRESS:
if SmartWalletChecker(checker).check(addr):
return
raise "Smart contract depositors not allowed"
Approve/Revoke SmartContracts¶
approveWallet
¶
SmartWalletChecker.approveWallet(address _wallet) public
Guarded Method
This function is only callable by the dao
, which is the CurveOwnershipAdmin
.
Function to approve a smart contract to lock CRV.
Emits: ApproveWallet
Input | Type | Description |
---|---|---|
_wallet | address | smart contract to approve |
Source code
revokeWallet
¶
SmartWalletChecker.revokeWallet(address _wallet) external
Guarded Method
This function is only callable by the dao
, which is the CurveOwnershipAdmin
.
Function to revoke the allowance of a smart contract to lock CRV.
Emits: RevokeWallet
Input | Type | Description |
---|---|---|
_wallet | address | smart contract to revoke |
Source code
Contract Info Methods¶
check
¶
SmartWalletChecker.check(address _wallet) external view returns (bool)
Function to check if a wallet has been approved.
Returns: True or False (bool
).
Input | Type | Description |
---|---|---|
_wallet | address | smart contract address |
Source code
dao
¶
SmartWalletChecker.commit_smart_wallet_checker(addr: address):
Getter for the dao of the contract. dao
in this context is pretty much the admin/owner of the contract.
Returns: CurveOwnershipAgent (address
).