Verified contractPartialApache-2.0
RegistrationController
Address0xec4ddc3b27fffc9593ee63085cbf05bffab6be37
- Balance
0 ETH
- Transactions
1
- Compiler
solc 0.8.30
- Same code
Only this contract
Details
- Compiler
- solc 0.8.30+commit.73712a01
- Language
- solidity
- Optimization
- Yes, 1 runs
- EVM version
- osaka
- License
- Apache-2.0
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,391,886
- Creation transaction
- 0x6ade7419f0…7ff3f47ab9
152 files
The source code is large: one file is shown at a time. Choose a file in the list.
- src/periphery/RegistrationController.solmain10.85 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/access/Ownable.sol3.1 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC1363.sol4.45 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC165.sol192 B
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC20.sol181 B
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC5267.sol739 B
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol2.78 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol9.39 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/utils/Context.sol963 B
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/utils/Panic.sol1.97 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/utils/ShortStrings.sol4.28 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/utils/SlotDerivation.sol5.32 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol4.18 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/utils/Strings.sol14.83 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/utils/TransientSlot.sol5.07 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol7.82 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol6.61 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/utils/cryptography/MessageHashUtils.sol3.7 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol870 B
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/utils/math/Math.sol29.66 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/utils/math/SafeCast.sol34.94 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/utils/math/SignedMath.sol2.61 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/utils/structs/BitMaps.sol2.02 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/utils/structs/Checkpoints.sol21.43 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/utils/structs/EnumerableSet.sol12.89 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/interfaces/IEscapeHatch.sol3.58 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/interfaces/IFeeJuicePortal.sol1.18 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/interfaces/IRollup.sol13.11 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/interfaces/ISequencerRewardCalculator.sol2.17 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/interfaces/ISlasher.sol530 B
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/interfaces/IStaking.sol5.72 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/interfaces/IValidatorSelection.sol2.98 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/interfaces/IVerifier.sol225 B
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/interfaces/messagebridge/IInbox.sol7.21 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/interfaces/messagebridge/IOutbox.sol4.6 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/ConstantsGen.sol1.55 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/DataStructures.sol1.96 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/Errors.sol16.7 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/HatchMath.sol575 B
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/SlashRoundLib.sol1.93 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/StakingQueue.sol2.31 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/TimeLib.sol6.05 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/compressed-data/CheckpointLog.sol4.15 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/compressed-data/StakingQueueConfig.sol2.87 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/compressed-data/Tips.sol2.19 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/compressed-data/fees/FeeConfig.sol5.17 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/compressed-data/fees/FeeStructs.sol5.18 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/crypto/Hash.sol3.03 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/crypto/MerkleLib.sol2.91 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/crypto/SampleLib.sol3.77 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/rollup/AttestationLib.sol8.66 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/rollup/BlobLib.sol11.87 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/rollup/CoordinationSignatureLib.sol3.19 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/rollup/FeeLib.sol24.27 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/rollup/FieldLib.sol889 B
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/rollup/ProposeLib.sol28.01 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/rollup/ProposedHeaderLib.sol2.24 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/rollup/RewardLib.sol20.85 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/rollup/STFLib.sol25.95 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/rollup/SequencerRewardCalculatorLib.sol5.93 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/rollup/StakingLib.sol51.03 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/libraries/rollup/ValidatorSelectionLib.sol37.95 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/reward-boost/RewardBooster.sol5.04 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/core/slashing/Slasher.sol2.91 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/governance/Bn254LibWrapper.sol752 B
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/governance/GSE.sol39.93 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/governance/GSEPayload.sol6.29 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/governance/Governance.sol32.6 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/governance/interfaces/IBn254LibWrapper.sol459 B
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/governance/interfaces/IEmpire.sol1.3 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/governance/interfaces/IGovernance.sol3.91 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/governance/interfaces/IGovernanceProposer.sol359 B
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/governance/interfaces/IPayload.sol597 B
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/governance/interfaces/IProposerPayload.sol327 B
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/governance/interfaces/IRegistry.sol1.21 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/governance/interfaces/IRewardDistributor.sol1.28 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/governance/libraries/AddressSnapshotLib.sol9.83 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/governance/libraries/CheckpointedUintLib.sol3.02 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/governance/libraries/ConfigurationLib.sol5 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/governance/libraries/DepositDelegationLib.sol10.98 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/governance/libraries/Errors.sol4.49 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/governance/libraries/ProposalLib.sol8.54 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/governance/libraries/compressed-data/Ballot.sol2.33 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/governance/libraries/compressed-data/Configuration.sol4.5 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/governance/libraries/compressed-data/Proposal.sol6.35 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/governance/proposer/EmpireBase.sol12.69 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/governance/proposer/GovernanceProposer.sol4.25 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/mock/libraries/BlobLib.sol5.65 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/shared/libraries/BN254Lib.sol10.21 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/shared/libraries/CompressedTimeMath.sol1.27 KB
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/shared/libraries/SignatureLib.sol983 B
- node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/shared/libraries/TimeMath.sol3.54 KB
- node_modules/@openzeppelin/contracts/access/Ownable.sol3.1 KB
- node_modules/@openzeppelin/contracts/account/Account.sol5.56 KB
- node_modules/@openzeppelin/contracts/account/extensions/draft-ERC7821.sol2.69 KB
- node_modules/@openzeppelin/contracts/account/utils/draft-ERC4337Utils.sol13.28 KB
- node_modules/@openzeppelin/contracts/account/utils/draft-ERC7579Utils.sol11.33 KB
- node_modules/@openzeppelin/contracts/interfaces/IERC1271.sol656 B
- node_modules/@openzeppelin/contracts/interfaces/IERC1363.sol4.45 KB
- node_modules/@openzeppelin/contracts/interfaces/IERC165.sol193 B
- node_modules/@openzeppelin/contracts/interfaces/IERC20.sol182 B
- node_modules/@openzeppelin/contracts/interfaces/IERC5267.sol740 B
- node_modules/@openzeppelin/contracts/interfaces/draft-IERC4337.sol10.53 KB
- node_modules/@openzeppelin/contracts/interfaces/draft-IERC7579.sol8.98 KB
- node_modules/@openzeppelin/contracts/interfaces/draft-IERC7821.sol1.76 KB
- node_modules/@openzeppelin/contracts/proxy/Clones.sol14.52 KB
- node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol2.78 KB
- node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol13.31 KB
- node_modules/@openzeppelin/contracts/utils/Address.sol6.8 KB
- node_modules/@openzeppelin/contracts/utils/Base64.sol10.66 KB
- node_modules/@openzeppelin/contracts/utils/Bytes.sol14.74 KB
- node_modules/@openzeppelin/contracts/utils/Calldata.sol697 B
- node_modules/@openzeppelin/contracts/utils/Context.sol963 B
- node_modules/@openzeppelin/contracts/utils/Create2.sol4.37 KB
- node_modules/@openzeppelin/contracts/utils/Errors.sol896 B
- node_modules/@openzeppelin/contracts/utils/LowLevelCall.sol5.55 KB
- node_modules/@openzeppelin/contracts/utils/Packing.sol64.87 KB
- node_modules/@openzeppelin/contracts/utils/Panic.sol1.97 KB
- node_modules/@openzeppelin/contracts/utils/ShortStrings.sol4.31 KB
- node_modules/@openzeppelin/contracts/utils/StorageSlot.sol4.18 KB
- node_modules/@openzeppelin/contracts/utils/Strings.sol21.54 KB
- node_modules/@openzeppelin/contracts/utils/cryptography/ECDSA.sol12.15 KB
- node_modules/@openzeppelin/contracts/utils/cryptography/EIP712.sol6.7 KB
- node_modules/@openzeppelin/contracts/utils/cryptography/Hashes.sol1.03 KB
- node_modules/@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol8.63 KB
- node_modules/@openzeppelin/contracts/utils/cryptography/P256.sol19.34 KB
- node_modules/@openzeppelin/contracts/utils/cryptography/WebAuthn.sol12.83 KB
- node_modules/@openzeppelin/contracts/utils/cryptography/draft-ERC7739Utils.sol9.43 KB
- node_modules/@openzeppelin/contracts/utils/cryptography/signers/AbstractSigner.sol987 B
- node_modules/@openzeppelin/contracts/utils/cryptography/signers/draft-ERC7739.sol4.28 KB
- node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol871 B
- node_modules/@openzeppelin/contracts/utils/math/Math.sol32.66 KB
- node_modules/@openzeppelin/contracts/utils/math/SafeCast.sol34.94 KB
- node_modules/@openzeppelin/contracts/utils/math/SignedMath.sol2.61 KB
- src/core/interfaces/IOxidePortal.sol2.61 KB
- src/core/interfaces/IProverSubsidy.sol294 B
- src/core/lib/Errors.sol3.09 KB
- src/core/lib/ProverClaimLib.sol4.67 KB
- src/generated/OxideConstants.gen.sol1.42 KB
- src/periphery/AccountMetadataRegistry.sol4.62 KB
- src/periphery/Errors.sol10.42 KB
- src/periphery/Intent.sol857 B
- src/periphery/OxideAccount.sol4.4 KB
- src/periphery/RecoveryCommitmentLib.sol707 B
- src/periphery/SIPABase.sol5.88 KB
- src/periphery/SIPAFactory.sol4.3 KB
- src/periphery/interfaces/IAccountMetadataController.sol184 B
- src/periphery/interfaces/IForwardingTable.sol1.29 KB
- src/periphery/interfaces/INamePortal.sol223 B
- src/periphery/interfaces/INameRegistry.sol760 B
- src/periphery/interfaces/IOxideAccountFactory.sol260 B
- src/periphery/interfaces/IRegistrationController.sol486 B
src/periphery/RegistrationController.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.8.27;
import {AccountMetadataRegistry} from "./AccountMetadataRegistry.sol";
import {SIPABase} from "./SIPABase.sol";
import {SIPAFactory} from "./SIPAFactory.sol";
import {IOxideAccountFactory} from "./interfaces/IOxideAccountFactory.sol";
import {INameRegistry, DomainAuth} from "./interfaces/INameRegistry.sol";
import {INamePortal} from "./interfaces/INamePortal.sol";
import {IRegistrationController, SignedTerms, R1Install} from "./interfaces/IRegistrationController.sol";
import {IAccountMetadataController} from "./interfaces/IAccountMetadataController.sol";
import {OxideAccount} from "./OxideAccount.sol";
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
import {ERC4337Utils} from "@openzeppelin/contracts/account/utils/draft-ERC4337Utils.sol";
import {IEntryPoint, PackedUserOperation} from "@openzeppelin/contracts/interfaces/draft-IERC4337.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";
import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {Errors} from "@periphery/Errors.sol";
import {Intents} from "@periphery/Intent.sol";
contract RegistrationController is IRegistrationController, IAccountMetadataController, EIP712 {
bytes32 private constant SIGNED_TERMS_TYPEHASH = keccak256(
"SignedTerms(bytes32 nameHash,address owner,uint256 fee,uint256 minDeposit,uint256 nonce,uint256 deadline)"
);
IEntryPoint public constant ENTRY_POINT = ERC4337Utils.ENTRYPOINT_V08;
uint256 public constant R1_INSTALL_VERIFICATION_GAS = 155_000;
uint256 public constant R1_INSTALL_CALL_GAS_BASE = 390_000;
uint256 public constant R1_INSTALL_CALL_GAS_PER_WORD = 145_000;
INameRegistry public immutable NAME_REGISTRY;
address public immutable override SIPA_FACTORY;
IOxideAccountFactory public immutable ACCOUNT_FACTORY;
INamePortal public immutable NAME_PORTAL;
IERC20 public immutable FEE_TOKEN;
uint256 public immutable REGISTRATION_MIN;
uint256 public immutable REGISTRATION_FEE;
mapping(uint256 => address) public beneficiaries;
uint256 public nextBeneficiaryId;
mapping(address => bool) public isBeneficiary;
mapping(uint256 => bool) public usedTermsNonces;
event BeneficiaryAdded(uint256 indexed beneficiaryId, address indexed beneficiary);
event TermsApplied(
address indexed owner, bytes32 indexed nameHash, uint256 fee, uint256 minDeposit, uint256 nonce, uint256 deadline
);
constructor(
INameRegistry nameRegistry,
SIPAFactory sipaFactory,
IOxideAccountFactory accountFactory,
INamePortal namePortal,
IERC20 feeToken,
uint256 registrationMin,
uint256 registrationFee,
address initialBeneficiary
) EIP712("Oxide RegistrationController", "1") {
require(address(nameRegistry) != address(0), Errors.RegistrationController__ZeroNameRegistry());
require(address(sipaFactory) != address(0), Errors.RegistrationController__ZeroSIPAFactory());
require(address(accountFactory) != address(0), Errors.RegistrationController__ZeroAccountFactory());
require(address(namePortal) != address(0), Errors.RegistrationController__ZeroNamePortal());
require(address(feeToken) != address(0), Errors.RegistrationController__ZeroFeeToken());
NAME_REGISTRY = nameRegistry;
SIPA_FACTORY = address(sipaFactory);
ACCOUNT_FACTORY = accountFactory;
NAME_PORTAL = namePortal;
FEE_TOKEN = feeToken;
REGISTRATION_MIN = registrationMin;
REGISTRATION_FEE = registrationFee;
_addBeneficiary(initialBeneficiary);
}
function addBeneficiary(address beneficiary) external returns (uint256 beneficiaryId) {
require(msg.sender == Ownable(address(NAME_REGISTRY)).owner(), Errors.RegistrationController__NotRegistryOwner());
beneficiaryId = _addBeneficiary(beneficiary);
}
function metadataStateHash(address owner) public view virtual override returns (bytes32) {
AccountMetadataRegistry registry = AccountMetadataRegistry(NAME_REGISTRY.accountMetadataRegistry());
return registry.hasUserRecord(owner) ? keccak256(abi.encode(registry.getUserRecord(owner))) : bytes32(0);
}
function _addBeneficiary(address beneficiary) internal returns (uint256 beneficiaryId) {
require(beneficiary != address(0), Errors.RegistrationController__ZeroBeneficiary());
beneficiaryId = nextBeneficiaryId++;
beneficiaries[beneficiaryId] = beneficiary;
isBeneficiary[beneficiary] = true;
emit BeneficiaryAdded(beneficiaryId, beneficiary);
}
function register(address token, uint256 balance, bytes calldata registrationData, bytes calldata proofs)
external
override
{
_requireRegistrationSIPA(msg.sender, registrationData);
require(token == address(FEE_TOKEN), Errors.RegistrationController__FeeTokenMismatch(token, address(FEE_TOKEN)));
(bytes memory recordData, uint256 fee, address beneficiary,, bytes32 namePortalRecipient) =
abi.decode(registrationData, (bytes, uint256, address, bytes32, bytes32));
(, uint256 relayerFee,) = SIPABase(msg.sender).route(token);
_register(
RegisterArgs({
recordData: recordData,
fee: fee,
beneficiary: beneficiary,
namePortalRecipient: namePortalRecipient,
balance: balance,
relayerFee: relayerFee
}),
proofs
);
}
struct RegisterArgs {
bytes recordData;
uint256 fee;
address beneficiary;
bytes32 namePortalRecipient;
uint256 balance;
uint256 relayerFee;
}
function _register(RegisterArgs memory a, bytes calldata proofs) internal {
(
bytes memory consentSig,
address bootstrap,
DomainAuth memory domainAuth,
SignedTerms memory terms,
R1Install memory r1
) = abi.decode(proofs, (bytes, address, DomainAuth, SignedTerms, R1Install));
(address owner, bytes32 nameHash, AccountMetadataRegistry.UserRecord memory record) =
abi.decode(a.recordData, (address, bytes32, AccountMetadataRegistry.UserRecord));
_verifyConsent(a.recordData, consentSig, bootstrap, owner, msg.sender);
_checkPayment(nameHash, owner, a, terms);
NAME_REGISTRY.claimName(nameHash, owner, domainAuth);
AccountMetadataRegistry(NAME_REGISTRY.accountMetadataRegistry()).setUserRecord(owner, record);
if (a.namePortalRecipient != bytes32(0)) {
NAME_PORTAL.notify(owner, a.namePortalRecipient, record.rollupVersion);
}
_installR1Key(owner, r1);
}
function _installR1Key(address owner, R1Install memory r1) internal {
OxideAccount account = OxideAccount(payable(owner));
if (account.authKeyCount() != 0) {
return;
}
PackedUserOperation[] memory ops = new PackedUserOperation[](1);
ops[0] = _r1InstallUserOp(owner, r1);
ENTRY_POINT.handleOps(ops, payable(owner));
require(account.authKeyCount() != 0, Errors.RegistrationController__R1KeyNotInstalled());
}
function _r1InstallUserOp(address owner, R1Install memory r1) internal view returns (PackedUserOperation memory op) {
op.sender = owner;
op.nonce = ENTRY_POINT.getNonce(owner, 0);
op.callData = abi.encodeCall(OxideAccount.addAuthKey, (OxideAccount.R1Key({qx: r1.qx, qy: r1.qy}), r1.metadata));
op.accountGasLimits = bytes32((R1_INSTALL_VERIFICATION_GAS << 128) | _r1InstallCallGas(r1.metadata.length));
op.signature = r1.signature;
}
function _r1InstallCallGas(uint256 metadataLength) internal pure returns (uint256) {
uint256 words = (metadataLength + 31) / 32;
if (metadataLength >= 32) {
words += 1;
}
return R1_INSTALL_CALL_GAS_BASE + R1_INSTALL_CALL_GAS_PER_WORD * words;
}
function _verifyConsent(
bytes memory recordData,
bytes memory consentSig,
address bootstrap,
address owner,
address sipa
) internal {
address account = ACCOUNT_FACTORY.deploy(bootstrap);
require(account == owner, Errors.RegistrationController__AccountMismatch(account, owner));
bytes4 result = IERC1271(owner).isValidSignature(_consentDigest(recordData, sipa), consentSig);
require(result == IERC1271.isValidSignature.selector, Errors.RegistrationController__InvalidConsent(owner));
}
function _checkPayment(bytes32 nameHash, address owner, RegisterArgs memory a, SignedTerms memory terms) internal {
uint256 expectedFee;
uint256 minDeposit;
if (_consumeSignedTermsIfPresent(nameHash, owner, terms)) {
expectedFee = terms.fee;
minDeposit = terms.minDeposit;
} else {
expectedFee = REGISTRATION_FEE;
minDeposit = REGISTRATION_MIN;
}
require(expectedFee >= a.relayerFee, Errors.RegistrationController__FeeBelowRelayerFee(expectedFee, a.relayerFee));
require(a.fee == expectedFee, Errors.RegistrationController__FeeMismatch(a.fee, expectedFee));
uint256 floor = minDeposit + a.fee;
require(a.balance >= floor, Errors.RegistrationController__BalanceBelowFloor(a.balance, floor));
if (a.fee > 0) {
require(isBeneficiary[a.beneficiary], Errors.RegistrationController__BeneficiaryNotAllowlisted(a.beneficiary));
}
}
function _consentDigest(bytes memory recordData, address sipa) internal view returns (bytes32) {
return keccak256(abi.encode(recordData, block.chainid, NAME_REGISTRY.accountMetadataRegistry(), sipa));
}
function _requireRegistrationSIPA(address caller, bytes calldata registrationData) internal view {
require(
SIPAFactory(SIPA_FACTORY).sipaIntentOf(caller) == Intents.REGISTRATION,
Errors.RegistrationController__CallerNotSIPA(caller)
);
SIPABase.Args memory args = abi.decode(Clones.fetchCloneArgs(caller), (SIPABase.Args));
require(args.intentHash == keccak256(registrationData), Errors.RegistrationController__RegistrationDataMismatch());
}
function _consumeSignedTermsIfPresent(bytes32 nameHash, address owner, SignedTerms memory terms)
internal
returns (bool)
{
if (terms.signature.length == 0) return false;
if (block.timestamp > terms.deadline) revert Errors.RegistrationController__TermsExpired();
if (usedTermsNonces[terms.nonce]) revert Errors.RegistrationController__TermsNonceAlreadyUsed();
bytes32 structHash = keccak256(
abi.encode(SIGNED_TERMS_TYPEHASH, nameHash, owner, terms.fee, terms.minDeposit, terms.nonce, terms.deadline)
);
if (ECDSA.recover(_hashTypedDataV4(structHash), terms.signature) != NAME_REGISTRY.domainOwner()) {
revert Errors.RegistrationController__InvalidTermsSignature();
}
usedTermsNonces[terms.nonce] = true;
emit TermsApplied(owner, nameHash, terms.fee, terms.minDeposit, terms.nonce, terms.deadline);
return true;
}
}
Compiler settingsShow
{
"viaIR": false,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "none",
"useLiteralContent": false
},
"libraries": {},
"optimizer": {
"runs": 1,
"enabled": true
},
"evmVersion": "osaka",
"remappings": [
"@core/=src/core/",
"@periphery/=src/periphery/",
"@generated/=src/generated/",
"@aztec/=node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/",
"@aztec-blob-lib/=node_modules/@aztec-foundation/l1-artifacts/l1-contracts/src/mock/libraries/",
"@zkpassport/=node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/circuits/src/solidity/src/",
"@oz/=node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/",
"@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/",
"node_modules/@aztec-foundation/l1-artifacts/l1-contracts/:@openzeppelin/contracts/=node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/",
"node_modules/@aztec-foundation/l1-artifacts/l1-contracts/:@openzeppelin/contracts/=node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/contracts/",
"@uniswap/universal-router/=node_modules/@uniswap/universal-router/",
"@uniswap/v4-core/=node_modules/@uniswap/v4-core/",
"@uniswap/v4-periphery/=node_modules/@uniswap/v4-periphery/",
"@uniswap/v2-core/=node_modules/@uniswap/v2-core/",
"@account-abstraction/contracts/=node_modules/@account-abstraction/contracts/",
"@nitro-validator/=.deps/nitro-validator/src/",
"@solarity/libs/=.deps/solidity-lib/contracts/libs/",
"@test/=test/",
"forge-std/=node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/forge-std/src/",
"node_modules/@uniswap/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=node_modules/@uniswap/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/",
"node_modules/@uniswap/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=node_modules/@uniswap/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/",
"node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/",
"node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/",
"node_modules/@uniswap/v4-periphery/lib/permit2/lib/forge-std/:ds-test/=node_modules/@uniswap/v4-periphery/lib/permit2/lib/forge-std/lib/ds-test/",
"node_modules/@uniswap/v4-periphery/lib/permit2/lib/forge-std/:ds-test/=node_modules/@uniswap/v4-periphery/lib/permit2/lib/forge-std/lib/ds-test/",
"node_modules/@uniswap/v4-periphery/lib/permit2/lib/solmate/:ds-test/=node_modules/@uniswap/v4-periphery/lib/permit2/lib/solmate/lib/ds-test/",
"node_modules/@uniswap/v4-periphery/lib/permit2/lib/solmate/:ds-test/=node_modules/@uniswap/v4-periphery/lib/permit2/lib/solmate/lib/ds-test/",
"node_modules/@uniswap/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/:erc4626-tests/=node_modules/@uniswap/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
"node_modules/@uniswap/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/:erc4626-tests/=node_modules/@uniswap/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
"node_modules/@uniswap/v4-periphery/lib/v4-core/lib/solmate/:ds-test/=node_modules/@uniswap/v4-periphery/lib/v4-core/lib/solmate/lib/ds-test/",
"node_modules/@uniswap/v4-periphery/lib/v4-core/lib/solmate/:ds-test/=node_modules/@uniswap/v4-periphery/lib/v4-core/lib/solmate/lib/ds-test/",
"node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/:erc4626-tests/=node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/lib/erc4626-tests/",
"node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/:erc4626-tests/=node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/lib/erc4626-tests/",
"node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/:erc4626-tests/=node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
"node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/:erc4626-tests/=node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
"node_modules/@uniswap/v4-core/lib/solmate/:ds-test/=node_modules/@uniswap/v4-core/lib/solmate/lib/ds-test/",
"node_modules/@uniswap/v4-core/lib/solmate/:ds-test/=node_modules/@uniswap/v4-core/lib/solmate/lib/ds-test/",
"node_modules/@uniswap/v4-periphery/lib/permit2/:openzeppelin-contracts/=node_modules/@uniswap/v4-periphery/lib/permit2/lib/openzeppelin-contracts/",
"node_modules/@uniswap/v4-periphery/lib/permit2/:openzeppelin-contracts/=node_modules/@uniswap/v4-periphery/lib/permit2/lib/openzeppelin-contracts/",
"node_modules/@uniswap/v4-periphery/lib/permit2/:solmate/=node_modules/@uniswap/v4-periphery/lib/permit2/lib/solmate/",
"node_modules/@uniswap/v4-periphery/lib/permit2/:solmate/=node_modules/@uniswap/v4-periphery/lib/permit2/lib/solmate/",
"node_modules/@uniswap/v4-periphery/lib/v4-core/:openzeppelin-contracts/=node_modules/@uniswap/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/",
"node_modules/@uniswap/v4-periphery/lib/v4-core/:openzeppelin-contracts/=node_modules/@uniswap/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/",
"node_modules/@uniswap/v4-periphery/lib/v4-core/:solmate/=node_modules/@uniswap/v4-periphery/lib/v4-core/lib/solmate/",
"node_modules/@uniswap/v4-periphery/lib/v4-core/:solmate/=node_modules/@uniswap/v4-periphery/lib/v4-core/lib/solmate/",
"node_modules/@aztec-foundation/l1-artifacts/l1-contracts/:openzeppelin-contracts/=node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/",
"node_modules/@aztec-foundation/l1-artifacts/l1-contracts/:openzeppelin-contracts/=node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/",
"node_modules/@uniswap/universal-router/:@uniswap/v3-core/=node_modules/@uniswap/universal-router/node_modules/@uniswap/v3-core/",
"node_modules/@uniswap/universal-router/:@uniswap/v3-core/=node_modules/@uniswap/universal-router/node_modules/@uniswap/v3-core/",
"node_modules/@uniswap/v4-core/:openzeppelin-contracts/=node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/",
"node_modules/@uniswap/v4-core/:openzeppelin-contracts/=node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/",
"node_modules/@uniswap/v4-core/:solmate/=node_modules/@uniswap/v4-core/lib/solmate/",
"node_modules/@uniswap/v4-core/:solmate/=node_modules/@uniswap/v4-core/lib/solmate/",
"@account-abstraction/=node_modules/@account-abstraction/",
"@aztec-foundation/=node_modules/@aztec-foundation/",
"@openzeppelin/=node_modules/@openzeppelin/",
"@uniswap/=node_modules/@uniswap/",
"base64-sol/=node_modules/base64-sol/",
"circuits/=node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/circuits/",
"ds-test/=node_modules/@uniswap/v4-core/lib/solmate/lib/ds-test/",
"erc4626-tests/=node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-gas-snapshot/=node_modules/@uniswap/v4-periphery/lib/permit2/lib/forge-gas-snapshot/",
"halmos-cheatcodes/=node_modules/@aztec-foundation/l1-artifacts/l1-contracts/lib/openzeppelin-contracts/lib/halmos-cheatcodes/",
"openzeppelin-contracts/=node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/",
"permit2/=node_modules/@uniswap/v4-periphery/lib/permit2/",
"solmate/=node_modules/@uniswap/v4-core/lib/solmate/",
"v4-core/=node_modules/@uniswap/v4-periphery/lib/v4-core/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.