Skip to content

Commit

Permalink
fix: build and todos
Browse files Browse the repository at this point in the history
  • Loading branch information
ameeshaagrawal committed Jan 1, 2025
1 parent fa185bb commit 5a75aed
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 14 deletions.
4 changes: 2 additions & 2 deletions contracts/AddressResolver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ contract AddressResolver is Ownable, IAddressResolver {
/// @param chainSlug_ The chain slug
/// @return The address of the deployed Forwarder contract
function getOrDeployForwarderContract(
address appDeployer_,
address chainContractAddress_,
uint32 chainSlug_
) public returns (address) {
Expand Down Expand Up @@ -112,8 +113,7 @@ contract AddressResolver is Ownable, IAddressResolver {
}
}

// todo: what to do?
// _setConfig(appDeployer_, newForwarder);
_setConfig(appDeployer_, newForwarder);
emit ForwarderDeployed(newForwarder, salt);
return newForwarder;
}
Expand Down
5 changes: 5 additions & 0 deletions contracts/apps/payload-delivery/ContractFactoryPlug.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
pragma solidity ^0.8.13;
import {PlugBase} from "../../base/PlugBase.sol";
import {Ownable} from "../../utils/Ownable.sol";

/// @title ContractFactory
/// @notice Abstract contract for deploying contracts
contract ContractFactoryPlug is PlugBase, Ownable {
Expand All @@ -17,6 +18,10 @@ contract ContractFactoryPlug is PlugBase, Ownable {
bytes memory creationCode,
bytes32 salt
) public returns (address) {
if (msg.sender != address(socket__)) {
revert("Only socket can deploy contracts");
}

address addr;
assembly {
addr := create2(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {IAuctionHouse} from "../../../interfaces/IAuctionHouse.sol";
/// @notice Contract for managing auctions and placing bids
contract AuctionManager is AddressResolverUtil, Ownable(msg.sender) {
SignatureVerifier public immutable signatureVerifier__;
uint32 public immutable vmChainSlug;
mapping(bytes32 => Bid) public winningBids;
// asyncId => auction status
mapping(bytes32 => bool) public auctionClosed;
Expand All @@ -22,9 +23,11 @@ contract AuctionManager is AddressResolverUtil, Ownable(msg.sender) {
/// @param addressResolver_ The address of the address resolver
/// @param signatureVerifier_ The address of the signature verifier
constructor(
uint32 vmChainSlug_,
address addressResolver_,
SignatureVerifier signatureVerifier_
) AddressResolverUtil(addressResolver_) {
vmChainSlug = vmChainSlug_;
signatureVerifier__ = signatureVerifier_;
}

Expand Down Expand Up @@ -58,9 +61,10 @@ contract AuctionManager is AddressResolverUtil, Ownable(msg.sender) {
) external {
require(!auctionClosed[asyncId_], "Auction closed");

// todo: check chain slug for multiple offchain vm
address transmitter = signatureVerifier__.recoverSigner(
keccak256(abi.encode(address(this), asyncId_, fee, extraData)),
keccak256(
abi.encode(address(this), vmChainSlug, asyncId_, fee, extraData)
),
transmitterSignature
);

Expand Down
8 changes: 3 additions & 5 deletions contracts/apps/payload-delivery/app-gateway/QueueAsync.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import {IContractFactoryPlug} from "../../../interfaces/IContractFactoryPlug.sol
abstract contract QueueAsync is AddressResolverUtil {
uint256 public saltCounter;
uint256 public asyncCounter;

address public auctionManager;
address public feesManager;

CallParams[] public callParamsArray;
Expand All @@ -27,7 +25,6 @@ abstract contract QueueAsync is AddressResolverUtil {
mapping(bytes32 => PayloadBatch) public payloadBatches;
// asyncId => PayloadDetails[]
mapping(bytes32 => PayloadDetails[]) public payloadBatchDetails;

error InvalidPromise();

modifier onlyPromises() {
Expand All @@ -37,8 +34,9 @@ abstract contract QueueAsync is AddressResolverUtil {
_;
}

modifier onlyAuctionManager() {
if (msg.sender != auctionManager) revert NotAuctionManager();
modifier onlyAuctionManager(bytes32 asyncId_) {
if (msg.sender != payloadBatches[asyncId_].auctionManager)
revert NotAuctionManager();
_;
}

Expand Down
1 change: 1 addition & 0 deletions contracts/base/AppDeployerBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ abstract contract AppDeployerBase is AppGatewayBase, IAppDeployer {

address forwarderContractAddress = addressResolver
.getOrDeployForwarderContract(
address(this),
abi.decode(returnData_, (address)),
chainSlug
);
Expand Down
1 change: 1 addition & 0 deletions contracts/interfaces/IAddressResolver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ interface IAddressResolver {
/// @param chainSlug_ The identifier of the destination chain
/// @return The address of the newly deployed forwarder contract
function getOrDeployForwarderContract(
address appDeployer_,
address chainContractAddress_,
uint32 chainSlug_
) external returns (address);
Expand Down
1 change: 0 additions & 1 deletion contracts/socket/Socket.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ contract Socket is SocketBase {
/**
* @dev keeps track of whether a payload has been executed or not using payload id
*/
// todo: add nottried, reverting and success
mapping(bytes32 => bool) public payloadExecuted;

constructor(
Expand Down
4 changes: 0 additions & 4 deletions contracts/socket/switchboard/FastSwitchboard.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ contract FastSwitchboard is SwitchboardBase {
bytes32 root_,
bytes calldata signature_
) external {
// removed root verification for now

// todo: can include orderHash, transmitter, bidAmount in digest and verify these
// here instead of including in root
address watcher = signatureVerifier__.recoverSigner(
keccak256(abi.encode(address(this), root_)),
signature_
Expand Down

0 comments on commit 5a75aed

Please sign in to comment.