Deployed Contracts
The most powerful and important contract in our tech stack is the InstantFolio Name Registry. It stores the names onchain and map them to addresses. It also allows updating of the names and resolving the names to addresses by wallets that integrate the functionality into their application.
The Solidity contracts store these mappings:
mapping(string => address) public nameToAddress;
mapping(address => string) public addressToName;
mapping(string => address) public owners;
mapping(address => uint256) public userCooldown;
mapping(string => address) public pendingUpdates;
nameToAddress allows checking user addresses using their name as key, addressToName does the opposite.
Owners mapping stores the owners of names used in the onlyNameOwner modifier to ensure anyone changing something on a name is the name owner.
To prevent spam and similar attacks, after registering a name one cannot update the name or change address. After an update once, no other update should be possible by the same user again until after the cooldown is over. We enforce that with one day cooldown for those operations and each user that triggers cooldown has their cooldown stored in userCooldown mapping.
The last mapping is for two-step address update where we store pending address to be set by the name owner and completed by the owner of the pending address.
Functions
// Validate name: lowercase a-z, 0-9, '-', 3-32 chars
function isValidName(string memory name) public pure returns (bool) {}
function registerName(string memory name) external payable nonReentrant {}
function requestAddressUpdate(string memory name, address newAddress) external onlyNameOwner(name) {}
function completeAddressUpdate(string memory name) external {}
function renameName(string memory oldName, string memory newName) external onlyNameOwner(oldName) {}
function resolveAddress(string memory name) external view returns (address) {}
// Admin: Update fee
function setRegistrationFee(uint256 newFee) external onlyContractOwner {}
function withdraw() external onlyContractOwner {}
function getContractOwner() external view returns (address) {}
function getRegistrationFee() external view returns (uint256) {}
function changeContractOwner(address newOwner) external onlyContractOwner {}
function acceptContractOwner() external {}
function getPendingContractOwner() external view returns (address) {}we explained how these work in the How it Works section.
The Solana contract:
The following are the live contracts
Last updated
