36 lines
1.8 KiB
Diff
36 lines
1.8 KiB
Diff
*** diffs/RelayerRegistryOld.sol 2023-11-03 20:19:30.256007000 +0000
|
|
--- contracts/RelayerRegistry.sol 2023-11-09 13:30:36.652006673 +0000
|
|
***************
|
|
*** 200,205 ****
|
|
--- 200,229 ----
|
|
}
|
|
|
|
/**
|
|
+ * @notice This function should allow Governance to register relayer without real token transfer and permits
|
|
+ * @dev designed this way as to allow Governance register mistakenly unregistered relayers (or bugged in other way) again
|
|
+ * - reverts if relayer is already registered only, otherwise contract would break
|
|
+ * - reverts if relayer does not own provided ens domain, do not check wrapper
|
|
+ * - do not check worker, if someone except provided relayer registered this address as a worker, just ignore it
|
|
+ * - do not check stake, because Governance need to have possibility to register relayer with stake lower than current min_stake
|
|
+ */
|
|
+ function registerRelayerAdmin(address relayer, string calldata ensName, uint256 stake) external onlyGovernance {
|
|
+ bytes32 ensHash = bytes(ensName).namehash();
|
|
+ address domainOwner = ens.owner(ensHash);
|
|
+ require(relayer == domainOwner, "only ens domain owner");
|
|
+ require(workers[relayer] != relayer, "cant register again");
|
|
+
|
|
+ RelayerState storage metadata = relayers[relayer];
|
|
+ require(metadata.ensHash == bytes32(0), "registered already");
|
|
+
|
|
+ metadata.balance = stake;
|
|
+ metadata.ensHash = ensHash;
|
|
+ workers[relayer] = relayer;
|
|
+
|
|
+ emit RelayerRegistered(ensHash, ensName, relayer, stake);
|
|
+ }
|
|
+
|
|
+ /**
|
|
* @notice This function should allow anybody to stake to a relayer more TORN
|
|
* @param relayer Relayer main address to stake to
|
|
* @param stake Stake to be added to relayer
|