🔓Rules
TL;DR You deploy Rule.sol
smart contract, which consist of set of rules, that allows Curra to make few actions with your proxy wallets:
Deploy specific Forwarder implementation to your proxy wallets
Transfer assets only to your whitelisted wallets, specified at
Rule.sol
.
You can set multiple destination wallets to distribute assets.
Thanks to flexibility of Curra smart-contracts, in case end-user send any "unconfigured" token or token standard to Proxy Wallet - you still have an ability to recover it, just configuring via UI.
In-depth explanation
Rules are smart contracts deployed by Curra users to ensure that users' assets can only be forwarded to certain wallets, making Curra the first-ever payment processing tool that doesn't require direct access to your assets for processing. These rules are executed every time assets are going to be forwarded by the protocol.
As mentioned before users can deploy their own rules contracts, those contracts are required to extend RuleBase.sol interface, let's take a look at it:
As you can see here are multiple methods for each token standard, for example, let's look at the execERC20()
method, which is going to be executed every time when coordinator tries to forward your ERC20 assets. _execERC20()
method accepts the following params:
forwarder
– receiving address which is going to be processed by an coordinatortoken
– address of ERC20 asset that is going to be forwardedvalue
– amount of ERC20 asset that is going to be forwardeddest
– forwarding destination address
To clarify how to rule contract can be implemented, let's examine this method with the default rule WhitelistedAddressRule.sol which is automatically assigned to your Ownership NFT after it's minted. It serves only for a single feature: allow forwarding only to the address which minted an NFT.
The first thing you can notice is that WhitelistedAddressRule.sol extends the RuleBase.sol contract, which is required for all rules to extend and implement virtual methods.
Last updated