mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
spell-connector
This commit is contained in:
parent
fdc00965f9
commit
8aec31057d
|
@ -26,6 +26,15 @@ interface AccountInterface {
|
|||
function enable(address) external;
|
||||
function disable(address) external;
|
||||
function isAuth(address) external view returns (bool);
|
||||
function cast(
|
||||
string[] calldata _targetNames,
|
||||
bytes[] calldata _datas,
|
||||
address _origin
|
||||
) external payable returns (bytes32[] memory responses);
|
||||
}
|
||||
|
||||
interface ListInterface {
|
||||
function accountID(address) external returns (uint64);
|
||||
}
|
||||
|
||||
interface InstaConnectors {
|
||||
|
|
11
contracts/arbitrum/connectors/spell/events.sol
Normal file
11
contracts/arbitrum/connectors/spell/events.sol
Normal file
|
@ -0,0 +1,11 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.7.0;
|
||||
pragma abicoder v2;
|
||||
|
||||
contract Events {
|
||||
event LogCastDSA(
|
||||
address indexed targetDSA,
|
||||
string[] connectors,
|
||||
bytes[] datas
|
||||
);
|
||||
}
|
12
contracts/arbitrum/connectors/spell/helpers.sol
Normal file
12
contracts/arbitrum/connectors/spell/helpers.sol
Normal file
|
@ -0,0 +1,12 @@
|
|||
//SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.7.0;
|
||||
|
||||
import { ListInterface } from "../../common/interfaces.sol";
|
||||
|
||||
contract SpellHelpers {
|
||||
/**
|
||||
* @dev InstaList
|
||||
*/
|
||||
ListInterface internal constant instaList =
|
||||
ListInterface(0x3565F6057b7fFE36984779A507fC87b31EFb0f09);
|
||||
}
|
42
contracts/arbitrum/connectors/spell/main.sol
Normal file
42
contracts/arbitrum/connectors/spell/main.sol
Normal file
|
@ -0,0 +1,42 @@
|
|||
//SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.7.0;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
/**
|
||||
* @title Spell.
|
||||
* @dev Cast on DSAs.
|
||||
*/
|
||||
|
||||
// import files
|
||||
import { AccountInterface } from "../../common/interfaces.sol";
|
||||
import { SpellHelpers } from "./helpers.sol";
|
||||
import { Events } from "./events.sol";
|
||||
|
||||
abstract contract Spell is SpellHelpers, Events {
|
||||
/**
|
||||
*@dev Cast spells on DSA.
|
||||
*@param targetDSA target DSA to cast spells on.
|
||||
*@param connectors connector names.
|
||||
*@param datas datas for the cast.
|
||||
*/
|
||||
function castDSA(
|
||||
address targetDSA,
|
||||
string[] memory connectors,
|
||||
bytes[] memory datas
|
||||
)
|
||||
external
|
||||
payable
|
||||
returns (string memory _eventName, bytes memory _eventParam)
|
||||
{
|
||||
require(instaList.accountID(targetDSA) != 0, "not-a-DSA");
|
||||
|
||||
AccountInterface(targetDSA).cast(connectors, datas, address(0));
|
||||
|
||||
_eventName = "LogCastDSA(address,string[],bytes[])";
|
||||
_eventParam = abi.encode(targetDSA, connectors, datas);
|
||||
}
|
||||
}
|
||||
|
||||
contract ConnectV2SpellConnectorPolygon is Spell {
|
||||
string public name = "Spell-Connector-v1.0";
|
||||
}
|
|
@ -21,6 +21,15 @@ interface AccountInterface {
|
|||
function enable(address) external;
|
||||
function disable(address) external;
|
||||
function isAuth(address) external view returns (bool);
|
||||
function cast(
|
||||
string[] calldata _targetNames,
|
||||
bytes[] calldata _datas,
|
||||
address _origin
|
||||
) external payable returns (bytes32[] memory responses);
|
||||
}
|
||||
|
||||
interface ListInterface {
|
||||
function accountID(address) external returns (uint64);
|
||||
}
|
||||
|
||||
interface InstaConnectors {
|
||||
|
|
11
contracts/avalanche/connectors/spell/events.sol
Normal file
11
contracts/avalanche/connectors/spell/events.sol
Normal file
|
@ -0,0 +1,11 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.7.0;
|
||||
pragma abicoder v2;
|
||||
|
||||
contract Events {
|
||||
event LogCastDSA(
|
||||
address indexed targetDSA,
|
||||
string[] connectors,
|
||||
bytes[] datas
|
||||
);
|
||||
}
|
12
contracts/avalanche/connectors/spell/helpers.sol
Normal file
12
contracts/avalanche/connectors/spell/helpers.sol
Normal file
|
@ -0,0 +1,12 @@
|
|||
//SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.7.0;
|
||||
|
||||
import { ListInterface } from "../../common/interfaces.sol";
|
||||
|
||||
contract SpellHelpers {
|
||||
/**
|
||||
* @dev InstaList
|
||||
*/
|
||||
ListInterface internal constant instaList =
|
||||
ListInterface(0x9926955e0Dd681Dc303370C52f4Ad0a4dd061687);
|
||||
}
|
42
contracts/avalanche/connectors/spell/main.sol
Normal file
42
contracts/avalanche/connectors/spell/main.sol
Normal file
|
@ -0,0 +1,42 @@
|
|||
//SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.7.0;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
/**
|
||||
* @title Spell.
|
||||
* @dev Cast on DSAs.
|
||||
*/
|
||||
|
||||
// import files
|
||||
import { AccountInterface } from "../../common/interfaces.sol";
|
||||
import { SpellHelpers } from "./helpers.sol";
|
||||
import { Events } from "./events.sol";
|
||||
|
||||
abstract contract Spell is SpellHelpers, Events {
|
||||
/**
|
||||
*@dev Cast spells on DSA.
|
||||
*@param targetDSA target DSA to cast spells on.
|
||||
*@param connectors connector names.
|
||||
*@param datas datas for the cast.
|
||||
*/
|
||||
function castDSA(
|
||||
address targetDSA,
|
||||
string[] memory connectors,
|
||||
bytes[] memory datas
|
||||
)
|
||||
external
|
||||
payable
|
||||
returns (string memory _eventName, bytes memory _eventParam)
|
||||
{
|
||||
require(instaList.accountID(targetDSA) != 0, "not-a-DSA");
|
||||
|
||||
AccountInterface(targetDSA).cast(connectors, datas, address(0));
|
||||
|
||||
_eventName = "LogCastDSA(address,string[],bytes[])";
|
||||
_eventParam = abi.encode(targetDSA, connectors, datas);
|
||||
}
|
||||
}
|
||||
|
||||
contract ConnectV2SpellConnectorPolygon is Spell {
|
||||
string public name = "Spell-Connector-v1.0";
|
||||
}
|
|
@ -34,6 +34,16 @@ interface AccountInterface {
|
|||
function disable(address) external;
|
||||
|
||||
function isAuth(address) external view returns (bool);
|
||||
|
||||
function cast(
|
||||
string[] calldata _targetNames,
|
||||
bytes[] calldata _datas,
|
||||
address _origin
|
||||
) external payable returns (bytes32[] memory responses);
|
||||
}
|
||||
|
||||
interface ListInterface {
|
||||
function accountID(address) external returns (uint64);
|
||||
}
|
||||
|
||||
interface InstaConnectors {
|
||||
|
|
11
contracts/fantom/connectors/spell/events.sol
Normal file
11
contracts/fantom/connectors/spell/events.sol
Normal file
|
@ -0,0 +1,11 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.7.0;
|
||||
pragma abicoder v2;
|
||||
|
||||
contract Events {
|
||||
event LogCastDSA(
|
||||
address indexed targetDSA,
|
||||
string[] connectors,
|
||||
bytes[] datas
|
||||
);
|
||||
}
|
12
contracts/fantom/connectors/spell/helpers.sol
Normal file
12
contracts/fantom/connectors/spell/helpers.sol
Normal file
|
@ -0,0 +1,12 @@
|
|||
//SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.7.0;
|
||||
|
||||
import { ListInterface } from "../../common/interfaces.sol";
|
||||
|
||||
contract SpellHelpers {
|
||||
/**
|
||||
* @dev InstaList
|
||||
*/
|
||||
ListInterface internal constant instaList =
|
||||
ListInterface(0x10e166c3FAF887D8a61dE6c25039231eE694E926);
|
||||
}
|
42
contracts/fantom/connectors/spell/main.sol
Normal file
42
contracts/fantom/connectors/spell/main.sol
Normal file
|
@ -0,0 +1,42 @@
|
|||
//SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.7.0;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
/**
|
||||
* @title Spell.
|
||||
* @dev Cast on DSAs.
|
||||
*/
|
||||
|
||||
// import files
|
||||
import { AccountInterface } from "../../common/interfaces.sol";
|
||||
import { SpellHelpers } from "./helpers.sol";
|
||||
import { Events } from "./events.sol";
|
||||
|
||||
abstract contract Spell is SpellHelpers, Events {
|
||||
/**
|
||||
*@dev Cast spells on DSA.
|
||||
*@param targetDSA target DSA to cast spells on.
|
||||
*@param connectors connector names.
|
||||
*@param datas datas for the cast.
|
||||
*/
|
||||
function castDSA(
|
||||
address targetDSA,
|
||||
string[] memory connectors,
|
||||
bytes[] memory datas
|
||||
)
|
||||
external
|
||||
payable
|
||||
returns (string memory _eventName, bytes memory _eventParam)
|
||||
{
|
||||
require(instaList.accountID(targetDSA) != 0, "not-a-DSA");
|
||||
|
||||
AccountInterface(targetDSA).cast(connectors, datas, address(0));
|
||||
|
||||
_eventName = "LogCastDSA(address,string[],bytes[])";
|
||||
_eventParam = abi.encode(targetDSA, connectors, datas);
|
||||
}
|
||||
}
|
||||
|
||||
contract ConnectV2SpellConnectorPolygon is Spell {
|
||||
string public name = "Spell-Connector-v1.0";
|
||||
}
|
|
@ -27,6 +27,15 @@ interface AccountInterface {
|
|||
function enable(address) external;
|
||||
function disable(address) external;
|
||||
function isAuth(address) external view returns (bool);
|
||||
function cast(
|
||||
string[] calldata _targetNames,
|
||||
bytes[] calldata _datas,
|
||||
address _origin
|
||||
) external payable returns (bytes32[] memory responses);
|
||||
}
|
||||
|
||||
interface ListInterface {
|
||||
function accountID(address) external returns (uint64);
|
||||
}
|
||||
|
||||
interface InstaConnectors {
|
||||
|
|
11
contracts/mainnet/connectors/spell/events.sol
Normal file
11
contracts/mainnet/connectors/spell/events.sol
Normal file
|
@ -0,0 +1,11 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.7.0;
|
||||
pragma abicoder v2;
|
||||
|
||||
contract Events {
|
||||
event LogCastDSA(
|
||||
address indexed targetDSA,
|
||||
string[] connectors,
|
||||
bytes[] datas
|
||||
);
|
||||
}
|
12
contracts/mainnet/connectors/spell/helpers.sol
Normal file
12
contracts/mainnet/connectors/spell/helpers.sol
Normal file
|
@ -0,0 +1,12 @@
|
|||
//SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.7.0;
|
||||
|
||||
import { ListInterface } from "../../common/interfaces.sol";
|
||||
|
||||
contract SpellHelpers {
|
||||
/**
|
||||
* @dev InstaList
|
||||
*/
|
||||
ListInterface internal constant instaList =
|
||||
ListInterface(0x4c8a1BEb8a87765788946D6B19C6C6355194AbEb);
|
||||
}
|
42
contracts/mainnet/connectors/spell/main.sol
Normal file
42
contracts/mainnet/connectors/spell/main.sol
Normal file
|
@ -0,0 +1,42 @@
|
|||
//SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.7.0;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
/**
|
||||
* @title Spell.
|
||||
* @dev Cast on DSAs.
|
||||
*/
|
||||
|
||||
// import files
|
||||
import { AccountInterface } from "../../common/interfaces.sol";
|
||||
import { SpellHelpers } from "./helpers.sol";
|
||||
import { Events } from "./events.sol";
|
||||
|
||||
abstract contract Spell is SpellHelpers, Events {
|
||||
/**
|
||||
*@dev Cast spells on DSA.
|
||||
*@param targetDSA target DSA to cast spells on.
|
||||
*@param connectors connector names.
|
||||
*@param datas datas for the cast.
|
||||
*/
|
||||
function castDSA(
|
||||
address targetDSA,
|
||||
string[] memory connectors,
|
||||
bytes[] memory datas
|
||||
)
|
||||
external
|
||||
payable
|
||||
returns (string memory _eventName, bytes memory _eventParam)
|
||||
{
|
||||
require(instaList.accountID(targetDSA) != 0, "not-a-DSA");
|
||||
|
||||
AccountInterface(targetDSA).cast(connectors, datas, address(0));
|
||||
|
||||
_eventName = "LogCastDSA(address,string[],bytes[])";
|
||||
_eventParam = abi.encode(targetDSA, connectors, datas);
|
||||
}
|
||||
}
|
||||
|
||||
contract ConnectV2SpellConnectorPolygon is Spell {
|
||||
string public name = "Spell-Connector-v1.0";
|
||||
}
|
|
@ -23,6 +23,15 @@ interface AccountInterface {
|
|||
function enable(address) external;
|
||||
function disable(address) external;
|
||||
function isAuth(address) external view returns (bool);
|
||||
function cast(
|
||||
string[] calldata _targetNames,
|
||||
bytes[] calldata _datas,
|
||||
address _origin
|
||||
) external payable returns (bytes32[] memory responses);
|
||||
}
|
||||
|
||||
interface ListInterface {
|
||||
function accountID(address) external returns (uint64);
|
||||
}
|
||||
|
||||
interface InstaConnectors {
|
||||
|
|
11
contracts/optimism/connectors/spell/events.sol
Normal file
11
contracts/optimism/connectors/spell/events.sol
Normal file
|
@ -0,0 +1,11 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.7.0;
|
||||
pragma abicoder v2;
|
||||
|
||||
contract Events {
|
||||
event LogCastDSA(
|
||||
address indexed targetDSA,
|
||||
string[] connectors,
|
||||
bytes[] datas
|
||||
);
|
||||
}
|
12
contracts/optimism/connectors/spell/helpers.sol
Normal file
12
contracts/optimism/connectors/spell/helpers.sol
Normal file
|
@ -0,0 +1,12 @@
|
|||
//SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.7.0;
|
||||
|
||||
import { ListInterface } from "../../common/interfaces.sol";
|
||||
|
||||
contract SpellHelpers {
|
||||
/**
|
||||
* @dev InstaList
|
||||
*/
|
||||
ListInterface internal constant instaList =
|
||||
ListInterface(0x9926955e0Dd681Dc303370C52f4Ad0a4dd061687);
|
||||
}
|
42
contracts/optimism/connectors/spell/main.sol
Normal file
42
contracts/optimism/connectors/spell/main.sol
Normal file
|
@ -0,0 +1,42 @@
|
|||
//SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.7.0;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
/**
|
||||
* @title Spell.
|
||||
* @dev Cast on DSAs.
|
||||
*/
|
||||
|
||||
// import files
|
||||
import { AccountInterface } from "../../common/interfaces.sol";
|
||||
import { SpellHelpers } from "./helpers.sol";
|
||||
import { Events } from "./events.sol";
|
||||
|
||||
abstract contract Spell is SpellHelpers, Events {
|
||||
/**
|
||||
*@dev Cast spells on DSA.
|
||||
*@param targetDSA target DSA to cast spells on.
|
||||
*@param connectors connector names.
|
||||
*@param datas datas for the cast.
|
||||
*/
|
||||
function castDSA(
|
||||
address targetDSA,
|
||||
string[] memory connectors,
|
||||
bytes[] memory datas
|
||||
)
|
||||
external
|
||||
payable
|
||||
returns (string memory _eventName, bytes memory _eventParam)
|
||||
{
|
||||
require(instaList.accountID(targetDSA) != 0, "not-a-DSA");
|
||||
|
||||
AccountInterface(targetDSA).cast(connectors, datas, address(0));
|
||||
|
||||
_eventName = "LogCastDSA(address,string[],bytes[])";
|
||||
_eventParam = abi.encode(targetDSA, connectors, datas);
|
||||
}
|
||||
}
|
||||
|
||||
contract ConnectV2SpellConnectorPolygon is Spell {
|
||||
string public name = "Spell-Connector-v1.0";
|
||||
}
|
|
@ -26,6 +26,15 @@ interface AccountInterface {
|
|||
function enable(address) external;
|
||||
function disable(address) external;
|
||||
function isAuth(address) external view returns (bool);
|
||||
function cast(
|
||||
string[] calldata _targetNames,
|
||||
bytes[] calldata _datas,
|
||||
address _origin
|
||||
) external payable returns (bytes32[] memory responses);
|
||||
}
|
||||
|
||||
interface ListInterface {
|
||||
function accountID(address) external returns (uint64);
|
||||
}
|
||||
|
||||
interface InstaConnectors {
|
||||
|
|
11
contracts/polygon/connectors/spell/events.sol
Normal file
11
contracts/polygon/connectors/spell/events.sol
Normal file
|
@ -0,0 +1,11 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.7.0;
|
||||
pragma abicoder v2;
|
||||
|
||||
contract Events {
|
||||
event LogCastDSA(
|
||||
address indexed targetDSA,
|
||||
string[] connectors,
|
||||
bytes[] datas
|
||||
);
|
||||
}
|
12
contracts/polygon/connectors/spell/helpers.sol
Normal file
12
contracts/polygon/connectors/spell/helpers.sol
Normal file
|
@ -0,0 +1,12 @@
|
|||
//SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.7.0;
|
||||
|
||||
import { ListInterface } from "../../common/interfaces.sol";
|
||||
|
||||
contract SpellHelpers {
|
||||
/**
|
||||
* @dev InstaList
|
||||
*/
|
||||
ListInterface internal constant instaList =
|
||||
ListInterface(0x839c2D3aDe63DF5b0b8F3E57D5e145057Ab41556);
|
||||
}
|
42
contracts/polygon/connectors/spell/main.sol
Normal file
42
contracts/polygon/connectors/spell/main.sol
Normal file
|
@ -0,0 +1,42 @@
|
|||
//SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.7.0;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
/**
|
||||
* @title Spell.
|
||||
* @dev Cast on DSAs.
|
||||
*/
|
||||
|
||||
// import files
|
||||
import { AccountInterface } from "../../common/interfaces.sol";
|
||||
import { SpellHelpers } from "./helpers.sol";
|
||||
import { Events } from "./events.sol";
|
||||
|
||||
abstract contract Spell is SpellHelpers, Events {
|
||||
/**
|
||||
*@dev Cast spells on DSA.
|
||||
*@param targetDSA target DSA to cast spells on.
|
||||
*@param connectors connector names.
|
||||
*@param datas datas for the cast.
|
||||
*/
|
||||
function castDSA(
|
||||
address targetDSA,
|
||||
string[] memory connectors,
|
||||
bytes[] memory datas
|
||||
)
|
||||
external
|
||||
payable
|
||||
returns (string memory _eventName, bytes memory _eventParam)
|
||||
{
|
||||
require(instaList.accountID(targetDSA) != 0, "not-a-DSA");
|
||||
|
||||
AccountInterface(targetDSA).cast(connectors, datas, address(0));
|
||||
|
||||
_eventName = "LogCastDSA(address,string[],bytes[])";
|
||||
_eventParam = abi.encode(targetDSA, connectors, datas);
|
||||
}
|
||||
}
|
||||
|
||||
contract ConnectV2SpellConnectorPolygon is Spell {
|
||||
string public name = "Spell-Connector-v1.0";
|
||||
}
|
Loading…
Reference in New Issue
Block a user