Skip to main content

RouteRandomizer

RouteRandomizer

version

string version

ERC165TAG

bytes4 ERC165TAG

RouteElement

struct RouteElement {
uint256 epochBlock;
bytes[] args;
}

contracts

address[] contracts

signatures

bytes[] signatures

probabilities

uint256[] probabilities

vrfBeacon

address vrfBeacon

elements

struct RouteRandomizer.RouteElement[] elements

queueIndex

uint256 queueIndex

constructor

constructor() public

initialize

function initialize(address _admin, address[] _contracts, bytes[] _signatures, uint8[] _probabilities, address _vrfBeacon, address _forwarder) external

Create RouteRandomizer instance

NameTypeDescription
_adminaddressthe admin/owner of the contract
_contractsaddress[]array of contract addresses to route to, each instance is defined with unique recipe
_signaturesbytes[]bytes array representing function signatures for each contract
_probabilitiesuint8[]array of cumulative proababilities associated with using a contract from contracts
_vrfBeaconaddress
_forwarderaddressaddress for trusted forwarder for open GSN integration

proxyInitialize

function proxyInitialize(address _admin, address[] _contracts, bytes[] _signatures, uint8[] _probabilities, address _vrfBeacon, address _forwarder) external

__RouteRandomizer_init

function __RouteRandomizer_init(address _admin, address[] _contracts, bytes[] _signatures, uint8[] _probabilities, address _vrfBeacon, address _forwarder) internal

__RouteRandomizer_init_unchained

function __RouteRandomizer_init_unchained(address[] _contracts, bytes[] _signatures, uint8[] _probabilities, address _vrfBeacon) internal

requestRouteRandomize

function requestRouteRandomize(bytes[] argsArr) external returns (uint256 requestId, uint256 blockNumber)

checkUpkeep

function checkUpkeep(bytes) external view returns (bool upkeepNeeded, bytes performData)

performUpkeep

function performUpkeep(bytes performData) external

method that is actually executed by the keepers, via the registry. The data returned by the checkUpkeep simulation will be passed into this method to actually be executed.

The input to this method should not be trusted, and the caller of the method should not even be restricted to any single registry. Anyone should be able call it, and the input should be validated, there is no guarantee that the data passed in is the performData returned from checkUpkeep. This could happen due to malicious keepers, racing keepers, or simply a state change while the performUpkeep transaction is waiting for confirmation. Always validate the data passed in.

NameTypeDescription
performDatabytesis the data which was passed back from the checkData simulation. If it is encoded, it can easily be decoded into other types by calling abi.decode. This data should not be trusted, and should be validated against the contract's current state.

_routeRandomize

function _routeRandomize(bytes[] argsArr, uint256 randomSeed) internal

getRandomContract

function getRandomContract(uint256 queueIndex, uint256 randomSeed) external view returns (uint256 selectedContract)

getQueueIndex

function getQueueIndex() public view returns (uint256)

supportsInterface

function supportsInterface(bytes4 interfaceId) public view virtual returns (bool)

ERC165 Support

NameTypeDescription
interfaceIdbytes4hash of the interface testing for
NameTypeDescription
[0]boolbool whether interface is supported