Skip to content

Commit

Permalink
rename Attestoor --> Attestor
Browse files Browse the repository at this point in the history
  • Loading branch information
mihailo-maksa committed Aug 21, 2024
1 parent ebc434e commit 2b561fd
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 94 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Intuition Attestoor Contracts
# Intuition Attestor Contracts

`Attestoor` contract allows for the whitelisted accounts to attest on behalf of the Intuiton itself, effectively acting as an official attestoor account. It follows the beacon proxy pattern, and is deployed via `AttestoorFactory` contract, which itself follows the transparent upgradeable proxy pattern.
`Attestor` contract allows for the whitelisted accounts to attest on behalf of the Intuiton itself, effectively acting as an official attestor account. It follows the beacon proxy pattern, and is deployed via `AttestorFactory` contract, which itself follows the transparent upgradeable proxy pattern.

## Building and Running Tests

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@0xintuition/intuition-contracts-attestoor",
"name": "@0xintuition/intuition-contracts-attestor",
"version": "1.0.0",
"description": "Attestoor contract allows for the whitelisted accounts to attest on behalf of the Intuiton itself, effectively acting as an official attestoor account.",
"description": "Attestor contract allows for the whitelisted accounts to attest on behalf of the Intuiton itself, effectively acting as an official attestor account.",
"type": "module",
"main": "index.js",
"scripts": {
Expand Down
46 changes: 23 additions & 23 deletions script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import {UpgradeableBeacon} from "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol";

import {Attestoor} from "src/Attestoor.sol";
import {AttestoorFactory} from "src/AttestoorFactory.sol";
import {Attestor} from "src/Attestor.sol";
import {AttestorFactory} from "src/AttestorFactory.sol";
import {IEthMultiVault} from "src/interfaces/IEthMultiVault.sol";

contract Deploy is Script {
Expand All @@ -18,47 +18,47 @@ contract Deploy is Script {
address admin = 0xEcAc3Da134C2e5f492B702546c8aaeD2793965BB; // Testnet multisig Safe address
address ethMultiVault = 0x78f576A734dEEFFd0C3550E6576fFf437933D9D5; // EthMultiVault proxy address on testnet

TransparentUpgradeableProxy attestoorFactoryProxy;
UpgradeableBeacon attestoorBeacon;
TransparentUpgradeableProxy attestorFactoryProxy;
UpgradeableBeacon attestorBeacon;

AttestoorFactory attestoorFactory;
Attestoor attestoor;
AttestorFactory attestorFactory;
Attestor attestor;

function run() external {
// Begin sending tx's to network
vm.startBroadcast();

// deploy Attestoor implementation contract
attestoor = new Attestoor();
console.logString("deployed Attestoor.");
// deploy Attestor implementation contract
attestor = new Attestor();
console.logString("deployed Attestor.");

// deploy attestoorBeacon pointing to the Attestoor implementation contract
attestoorBeacon = new UpgradeableBeacon(address(attestoor), admin);
// deploy attestorBeacon pointing to the Attestor implementation contract
attestorBeacon = new UpgradeableBeacon(address(attestor), admin);
console.logString("deployed UpgradeableBeacon.");

bytes memory initData = abi.encodeWithSelector(
AttestoorFactory.init.selector, admin, IEthMultiVault(ethMultiVault), address(attestoorBeacon)
AttestorFactory.init.selector, admin, IEthMultiVault(ethMultiVault), address(attestorBeacon)
);

// deploy AttestoorFactory implementation contract
attestoorFactory = new AttestoorFactory();
console.logString("deployed AttestoorFactory.");
// deploy AttestorFactory implementation contract
attestorFactory = new AttestorFactory();
console.logString("deployed AttestorFactory.");

// deploy TransparentUpgradeableProxy for AttestoorFactory
attestoorFactoryProxy = new TransparentUpgradeableProxy(
address(attestoorFactory), // logic contract address
// deploy TransparentUpgradeableProxy for AttestorFactory
attestorFactoryProxy = new TransparentUpgradeableProxy(
address(attestorFactory), // logic contract address
admin, // initial owner of the ProxyAdmin instance tied to the proxy
initData // data to pass to the logic contract's initializer function
);
console.logString("deployed TransparentUpgradeableProxy for AttestoorFactory.");
console.logString("deployed TransparentUpgradeableProxy for AttestorFactory.");

// stop sending tx's
vm.stopBroadcast();

console.log("All contracts deployed successfully:");
console.log("Attestoor implementation address:", address(attestoor));
console.log("attestoorBeacon address:", address(attestoorBeacon));
console.log("AttestoorFactory implementation address:", address(attestoorFactory));
console.log("AttestoorFactory proxy address:", address(attestoorFactoryProxy));
console.log("Attestor implementation address:", address(attestor));
console.log("attestorBeacon address:", address(attestorBeacon));
console.log("AttestorFactory implementation address:", address(attestorFactory));
console.log("AttestorFactory proxy address:", address(attestorFactoryProxy));
}
}
42 changes: 21 additions & 21 deletions src/Attestoor.sol → src/Attestor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import {Errors} from "src/libraries/Errors.sol";
import {IEthMultiVault} from "src/interfaces/IEthMultiVault.sol";

/**
* @title Attestoor
* @title Attestor
* @author 0xIntuition
* @notice A utility contract of the Intuition protocol. It allows for the whitelisted accounts to attest
* on behalf of the Intuiton itself, effectively acting as an official attestoor account.
* on behalf of the Intuiton itself, effectively acting as an official attestor account.
*/
contract Attestoor is Initializable, Ownable2StepUpgradeable {
contract Attestor is Initializable, Ownable2StepUpgradeable {
/// @notice The EthMultiVault contract address
IEthMultiVault public ethMultiVault;

Expand All @@ -33,12 +33,12 @@ contract Attestoor is Initializable, Ownable2StepUpgradeable {
/// @notice Modifier to allow only whitelisted attestors to call a function
modifier onlyWhitelistedAttestor() {
if (!whitelistedAttestors[msg.sender]) {
revert Errors.Attestoor_NotAWhitelistedAttestor();
revert Errors.Attestor_NotAWhitelistedAttestor();
}
_;
}

/// @notice Initializes the Attestoor contract
/// @notice Initializes the Attestor contract
///
/// @param admin The address of the admin
/// @param _ethMultiVault EthMultiVault contract
Expand Down Expand Up @@ -78,13 +78,13 @@ contract Attestoor is Initializable, Ownable2StepUpgradeable {
returns (uint256[] memory)
{
if (atomUris.length != values.length) {
revert Errors.Attestoor_WrongArrayLengths();
revert Errors.Attestor_WrongArrayLengths();
}

uint256 sum = _getSum(values);

if (msg.value < sum) {
revert Errors.Attestoor_InsufficientValue();
revert Errors.Attestor_InsufficientValue();
}

uint256[] memory ids = new uint256[](atomUris.length);
Expand Down Expand Up @@ -132,19 +132,19 @@ contract Attestoor is Initializable, Ownable2StepUpgradeable {
uint256[] calldata values
) external payable onlyWhitelistedAttestor returns (uint256[] memory) {
if (subjectIds.length != predicateIds.length || predicateIds.length != objectIds.length) {
revert Errors.Attestoor_WrongArrayLengths();
revert Errors.Attestor_WrongArrayLengths();
}

uint256 length = subjectIds.length;

if (length != values.length) {
revert Errors.Attestoor_WrongArrayLengths();
revert Errors.Attestor_WrongArrayLengths();
}

uint256 sum = _getSum(values);

if (msg.value < sum) {
revert Errors.Attestoor_InsufficientValue();
revert Errors.Attestor_InsufficientValue();
}

uint256[] memory ids = new uint256[](length);
Expand Down Expand Up @@ -176,13 +176,13 @@ contract Attestoor is Initializable, Ownable2StepUpgradeable {
returns (uint256[] memory)
{
if (ids.length != values.length) {
revert Errors.Attestoor_WrongArrayLengths();
revert Errors.Attestor_WrongArrayLengths();
}

uint256 sum = _getSum(values);

if (msg.value < sum) {
revert Errors.Attestoor_InsufficientValue();
revert Errors.Attestor_InsufficientValue();
}

uint256[] memory shares = new uint256[](ids.length);
Expand Down Expand Up @@ -214,13 +214,13 @@ contract Attestoor is Initializable, Ownable2StepUpgradeable {
returns (uint256[] memory)
{
if (ids.length != values.length) {
revert Errors.Attestoor_WrongArrayLengths();
revert Errors.Attestor_WrongArrayLengths();
}

uint256 sum = _getSum(values);

if (msg.value < sum) {
revert Errors.Attestoor_InsufficientValue();
revert Errors.Attestor_InsufficientValue();
}

uint256[] memory shares = new uint256[](ids.length);
Expand Down Expand Up @@ -255,11 +255,11 @@ contract Attestoor is Initializable, Ownable2StepUpgradeable {
returns (uint256[] memory)
{
if (shares.length != ids.length) {
revert Errors.Attestoor_WrongArrayLengths();
revert Errors.Attestor_WrongArrayLengths();
}

if (!_checkRedeemability(shares, ids)) {
revert Errors.Attestoor_SharesCannotBeRedeeemed();
revert Errors.Attestor_SharesCannotBeRedeeemed();
}

uint256[] memory assets = new uint256[](ids.length);
Expand Down Expand Up @@ -294,11 +294,11 @@ contract Attestoor is Initializable, Ownable2StepUpgradeable {
returns (uint256[] memory)
{
if (shares.length != ids.length) {
revert Errors.Attestoor_WrongArrayLengths();
revert Errors.Attestor_WrongArrayLengths();
}

if (!_checkRedeemability(shares, ids)) {
revert Errors.Attestoor_SharesCannotBeRedeeemed();
revert Errors.Attestor_SharesCannotBeRedeeemed();
}

uint256[] memory assets = new uint256[](ids.length);
Expand All @@ -314,7 +314,7 @@ contract Attestoor is Initializable, Ownable2StepUpgradeable {
/// @param _ethMultiVault EthMultiVault contract address
function setEthMultiVault(IEthMultiVault _ethMultiVault) external onlyOwner {
if (address(_ethMultiVault) == address(0)) {
revert Errors.Attestoor_InvalidEthMultiVaultAddress();
revert Errors.Attestor_InvalidEthMultiVaultAddress();
}

ethMultiVault = _ethMultiVault;
Expand All @@ -340,7 +340,7 @@ contract Attestoor is Initializable, Ownable2StepUpgradeable {
uint256 length = attestors.length;

if (length == 0) {
revert Errors.Attestoor_EmptyAttestorsArray();
revert Errors.Attestor_EmptyAttestorsArray();
}

for (uint256 i = 0; i < length; i++) {
Expand All @@ -358,7 +358,7 @@ contract Attestoor is Initializable, Ownable2StepUpgradeable {
/// @return bool Whether all shares can be redeemed or not
function _checkRedeemability(uint256[] calldata shares, uint256[] calldata ids) internal view returns (bool) {
if (shares.length != ids.length) {
revert Errors.Attestoor_WrongArrayLengths();
revert Errors.Attestor_WrongArrayLengths();
}

for (uint256 i = 0; i < ids.length; i++) {
Expand Down
Loading

0 comments on commit 2b561fd

Please sign in to comment.