πΉSolver Network
Uniroll supports the integration of solver networks to allow solvers to leverage shared settlement. Solvers create and fill intents on the spoke contracts while offchain agents handle settlement.
Introduction
Creating an Intent
contract Greeter {
// Storage
IERC20 public token;
IUnirollSpoke public uniroll;
// Destination chain configuration for Greeter
uint32 public destination;
address public destinationToken;
address public destinationGreeter;
// Stored greeting
string public greeting;
// Events
event GreetingDispatched(bytes32 indexed id, uin256 fee, string greeting);
constructor(
address _token,
address _uniroll,
uint32 _destination,
address _destinationToken,
address _destinationGreeter
) {
token = IERC20(_token);
uniroll = IUniroll(_uniroll);
destination = _destination;
destinationToken = _destinationToken;
destinationGreeter = _destinationGreeter;
greeting = "Pay me for change";
}
function setGreeting(string memory _greeting, uint256 _fee) public {
// Approve token to connext
token.approve(address(uniroll), _fee);
// Create the intent data
bytes memory data = bytes(_greeting);
// Call new intent
(bytes32 intentId, Intent memory intent) = uniroll.newIntent(
destination,
destinationGreeter,
address(token),
destinationToken,
_fee,
data
);
emit GreetingDispatched(intentId, fee, greeting);
}
}Filling Intents
Settlement
Last updated