Skip to content

Commit

Permalink
feat(context-module): add external plugin loader
Browse files Browse the repository at this point in the history
  • Loading branch information
aussedatlo committed May 15, 2024
1 parent b76691c commit 47ec609
Show file tree
Hide file tree
Showing 14 changed files with 1,057 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
[
{
"inputs": [
{
"internalType": "address[]",
"name": "fromToken",
"type": "address[]"
}
],
"name": "arrayParam",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "address1",
"type": "address"
},
{
"components": [
{
"components": [
{
"components": [
{
"internalType": "address[]",
"name": "addresses",
"type": "address[]"
}
],
"internalType": "struct SimpleContract.Struct3",
"name": "param3",
"type": "tuple"
}
],
"internalType": "struct SimpleContract.Struct2[]",
"name": "param2",
"type": "tuple[]"
}
],
"internalType": "struct SimpleContract.Struct1",
"name": "param1",
"type": "tuple"
}
],
"internalType": "struct SimpleContract.ComplexStruct",
"name": "complexStruct",
"type": "tuple"
}
],
"name": "complexStructParam",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "fromToken",
"type": "address"
},
{
"internalType": "address",
"name": "toToken",
"type": "address"
}
],
"name": "multipleParams",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "fromToken",
"type": "address"
}
],
"name": "singleParam",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.8.2 <0.9.0;

contract SimpleContract {
struct Struct3 {
address[] addresses;
}

struct Struct2 {
Struct3 param3;
}

struct Struct1 {
Struct2[] param2;
}

struct ComplexStruct {
address address1;
Struct1 param1;
}

function singleParam(address fromToken) public {
// Do nothing
}

function multipleParams(address fromToken, address toToken) public {
// Do nothing
}

function arrayParam(address[] calldata fromToken) public {
// Do nothing
}

function complexStructParam(ComplexStruct calldata complexStruct) public {
// Do nothing
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
export interface DappDTO {
b2c: B2c;
abis: Abis;
b2c_signatures: B2cSignatures;
}

export interface B2c {
blockchainName: string;
chainId: number;
contracts: Contract[];
name: string;
}

interface Contract {
address: string;
contractName: string;
selectors: { [selector: string]: ContractSelector };
}

interface ContractSelector {
erc20OfInterest: string[];
method: string;
plugin: string;
}

export interface Abis {
[address: string]: object;
}

export interface B2cSignatures {
[address: string]: {
[selector: string]: B2cSignature;
};
}

interface B2cSignature {
plugin: string;
serialized_data: string;
signature: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { DappInfos } from "../model/DappInfos";

export type GetDappInfos = {
address: string;
selector: `0x${string}`;
chainId: number;
};

export interface ExternalPluginDataSource {
getDappInfos(params: GetDappInfos): Promise<DappInfos | undefined>;
}

0 comments on commit 47ec609

Please sign in to comment.