Smart contract wallet for borrowing NFTs on the NFT Rental Exchange.
WARNING: This code has not been comprehensively tested or audited. The author is not responsible for any loss of funds. Meanwhile, please open an issue or a PR if you find any bugs or vulnerabilities.
NFTNFTWallet.sol
Singleton contract that implements the actual wallet functionality. Users can callexecTransaction
method to send transactions, but these transactions will be checked against theWalletPolicy
and transactions prohibited by this policy will not be executed.NFTNFTWalletProxy.sol
Proxy contract that routes requests toNFTNFTWallet
singleton. This contract represents the "App Wallet." A user is issued a new instance of this contract and they interact with that instance.NFTNFTWalletProxyFactory.sol
A factory for the proxy contract (app wallet). It creates and initializes new instances of the proxy contract. This contracts also keeps track of the issued proxies so that external contracts can check if a proxy is legitimately issued by this factory.WalletPolicy.sol
A contract that keeps track of whitelisted contracts the app wallet can interact with. Two levels of gating happens in the configuration:allowed
andscoped
. If a target is notallowed
, no transactions can be send to this target. If a target isallowed
but notscoped
, any transactions to this target can be sent. If a target isallowed
andscoped
, only whitelisted methods can be called.
mainnet:
goerli: 0x852eeE31C2474CA08497b882A53C1317Af2944D9
mainnet:
goerli: 0xE59e8a3050A744538bD0E7Bd99c51366a3F1d534
mainnet:
goerli: 0xf3B203294eE4EeB6eea4059dE61E1c9206D4d3B9
Install Foundry
Download foundryup
:
$ curl -L https://foundry.paradigm.xyz | bash
Then install Foundry:
$ foundryup
Clone the repo:
$ git clone https://github.com/ian-shim/app-wallet.git
Unit tests:
$ forge test [-vvvv]
Integration tests require forking mode:
(integration tests fork and use actual deployed contracts. Make sure the deployed addresses in the tests are correct)
$ forge test --fork-url <NODE_URL> --chain-id <CHAIN_ID> --etherscan-api-key <ETHERSCAN_KEY>