Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DB] Database Resolver fully compliant to EIP-5559 #97

Closed
pikonha opened this issue May 20, 2024 · 0 comments
Closed

[DB] Database Resolver fully compliant to EIP-5559 #97

pikonha opened this issue May 20, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@pikonha
Copy link
Contributor

pikonha commented May 20, 2024

Feature Request

Both the DatabaseResolver and the DB Gateway need to handle writing calls according to the EIP-5559.

Describe Preferred Solution

struct domainData {
    string name;
    string version;
    uint64 chainId;
    address verifyingContract;
}   

struct messageData {
    bytes4 functionSelector;
    address sender;
    parameter[] parameters;
    uint256 expirationTimestamp;
}

struct parameter {
    string name;
    string value;
}

function setAddr(bytes32 node, address a) external {
    IWriteDeferral.parameter[] memory params = new IWriteDeferral.parameter[](3);

    params[0].name = "node";
    params[0].value = BytesToString.bytes32ToString(node);

    params[1].name = "coin_type";
    params[1].value = Strings.toString(coinType);

    params[2].name = "address";
    params[2].value = BytesToString.bytesToString(a);

    revert StorageHandledByOffChainDatabase(
        IWriteDeferral.domainData(
            {
                name: WRITE_DEFERRAL_DOMAIN_NAME,
                version: WRITE_DEFERRAL_DOMAIN_VERSION,
                chainId: 1,
                verifyingContract: address(this)
            }
        ),
        _offChainDatabaseUrl,
        IWriteDeferral.messageData(
            {
                functionSelector: msg.sig,
                sender: msg.sender,
                parameters: params,
                expirationTimestamp: block.timestamp + _offChainDatabaseTimeoutDuration
            }
        )
    );
}

Related Code

#88

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: ✅ Done
Development

No branches or pull requests

1 participant