Skip to content

Commit

Permalink
minor updates on contract, and removed AutomataDcapAttestation.sol
Browse files Browse the repository at this point in the history
  • Loading branch information
preston4896 committed Nov 18, 2024
1 parent 8f63a44 commit 859cc19
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 56 deletions.
29 changes: 0 additions & 29 deletions contracts/AutomataDcapAttestation.sol

This file was deleted.

8 changes: 0 additions & 8 deletions contracts/AutomataDcapAttestationFee.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ import "./bases/FeeManagerBase.sol";
* needed to perform DCAP attestation.
*/
contract AutomataDcapAttestationFee is FeeManagerBase, AttestationEntrypointBase {
function enableFee() public override onlyOwner {
super.enableFee();
}

function disableFee() public override onlyOwner {
super.disableFee();
}

function setBp(uint16 _newBp) public override onlyOwner {
super.setBp(_newBp);
}
Expand Down
11 changes: 1 addition & 10 deletions contracts/bases/FeeManagerBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ abstract contract FeeManagerBase {
uint16 constant MAX_BP = 10_000;

uint16 _feeBP; // the percentage of gas fee in basis point;
bool _isFeeEnabled;

// 1356a63b
error BP_Not_Valid();
Expand All @@ -22,14 +21,6 @@ abstract contract FeeManagerBase {
_feeBP = _newBp;
}

function enableFee() public virtual {
_isFeeEnabled = true;
}

function disableFee() public virtual {
_isFeeEnabled = false;
}

function getBp() public view returns (uint16) {
return _feeBP;
}
Expand All @@ -44,7 +35,7 @@ abstract contract FeeManagerBase {

modifier collectFee() {
uint256 txFee;
if (_isFeeEnabled && _feeBP > 0) {
if (_feeBP > 0) {
uint256 gasBefore = gasleft();
_;
uint256 gasAfter = gasleft();
Expand Down
8 changes: 4 additions & 4 deletions forge-script/AttestationScript.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ pragma solidity ^0.8.0;

import "forge-std/Script.sol";
import {console2} from "forge-std/console2.sol";
import "../contracts/AutomataDcapAttestation.sol";
import "../contracts/AutomataDcapAttestationFee.sol";

contract AttestationScript is Script {
uint256 deployerKey = uint256(vm.envBytes32("PRIVATE_KEY"));

function deployEntrypoint() public {
vm.startBroadcast(deployerKey);

AutomataDcapAttestation attestation = new AutomataDcapAttestation();
AutomataDcapAttestationFee attestation = new AutomataDcapAttestationFee();

console.log("Automata Dcap Attestation deployed at: ", address(attestation));

Expand All @@ -22,7 +22,7 @@ contract AttestationScript is Script {
function configVerifier(address verifier) public {
address attestationAddr = vm.envAddress("DCAP_ATTESTATION");
vm.broadcast(deployerKey);
AutomataDcapAttestation(attestationAddr).setQuoteVerifier(verifier);
AutomataDcapAttestationFee(attestationAddr).setQuoteVerifier(verifier);
}

function configureZk(uint8 zk, address verifierGateway, bytes32 programId) public {
Expand All @@ -32,6 +32,6 @@ contract AttestationScript is Script {
ZkCoProcessorConfig({dcapProgramIdentifier: programId, zkVerifier: verifierGateway});

vm.broadcast(deployerKey);
AutomataDcapAttestation(attestationAddr).setZkConfiguration(ZkCoProcessorType(zk), config);
AutomataDcapAttestationFee(attestationAddr).setZkConfiguration(ZkCoProcessorType(zk), config);
}
}
10 changes: 5 additions & 5 deletions forge-test/AutomataDcapAttestationTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import {PlonkSetup} from "./utils/succinct/PlonkSetup.sol";
import {Groth16Setup} from "./utils/succinct/Groth16Setup.sol";

import {
AutomataDcapAttestation, ZkCoProcessorConfig, ZkCoProcessorType
} from "../contracts/AutomataDcapAttestation.sol";
AutomataDcapAttestationFee, ZkCoProcessorConfig, ZkCoProcessorType
} from "../contracts/AutomataDcapAttestationFee.sol";
import {V3QuoteVerifier} from "../contracts/verifiers/V3QuoteVerifier.sol";
import {V4QuoteVerifier} from "../contracts/verifiers/V4QuoteVerifier.sol";

import {ISP1Verifier} from "@sp1-contracts/ISP1Verifier.sol";

contract AutomataDcapAttestationTest is PCCSSetupBase, RiscZeroSetup {
AutomataDcapAttestation attestation;
contract AutomataDcapAttestationFeeTest is PCCSSetupBase, RiscZeroSetup {
AutomataDcapAttestationFee attestation;
PCCSRouter pccsRouter;

// Contracts used for testing only
Expand All @@ -31,7 +31,7 @@ contract AutomataDcapAttestationTest is PCCSSetupBase, RiscZeroSetup {
pcsDaoUpserts();

// DCAP Contract Deployment
attestation = new AutomataDcapAttestation();
attestation = new AutomataDcapAttestationFee();

vm.stopPrank();
}
Expand Down

0 comments on commit 859cc19

Please sign in to comment.