Skip to content

Commit 7f50b9c

Browse files
committed
feat(eth-multisig-v4): add opeth wallet contract
1 parent 56cf31c commit 7f50b9c

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
pragma solidity 0.8.20;
3+
import '../Forwarder.sol';
4+
import '../ERC20Interface.sol';
5+
import '../WalletSimple.sol';
6+
7+
/**
8+
*
9+
* WalletSimple
10+
* ============
11+
*
12+
* Basic multi-signer wallet designed for use in a co-signing environment where 2 signatures are required to move funds.
13+
* Typically used in a 2-of-3 signing configuration. Uses ecrecover to allow for 2 signatures in a single transaction.
14+
*
15+
* The first signature is created on the operation hash (see Data Formats) and passed to sendMultiSig/sendMultiSigToken
16+
* The signer is determined by verifyMultiSig().
17+
*
18+
* The second signature is created by the submitter of the transaction and determined by msg.signer.
19+
*
20+
* Data Formats
21+
* ============
22+
*
23+
* The signature is created with ethereumjs-util.ecsign(operationHash).
24+
* Like the eth_sign RPC call, it packs the values as a 65-byte array of [r, s, v].
25+
* Unlike eth_sign, the message is not prefixed.
26+
*
27+
* The operationHash the result of keccak256(prefix, toAddress, value, data, expireTime).
28+
* For ether transactions, `prefix` is "OPETH".
29+
* For token transaction, `prefix` is "OPETH-ERC20" and `data` is the tokenContractAddress.
30+
*
31+
*
32+
*/
33+
contract OpethWalletSimple is WalletSimple {
34+
/**
35+
* Get the network identifier that signers must sign over
36+
* This provides protection signatures being replayed on other chains
37+
*/
38+
function getNetworkId() internal override pure returns (string memory) {
39+
return 'OPETH';
40+
}
41+
42+
/**
43+
* Get the network identifier that signers must sign over for token transfers
44+
* This provides protection signatures being replayed on other chains
45+
*/
46+
function getTokenNetworkId() internal override pure returns (string memory) {
47+
return 'OPETH-ERC20';
48+
}
49+
50+
/**
51+
* Get the network identifier that signers must sign over for batch transfers
52+
* This provides protection signatures being replayed on other chains
53+
*/
54+
function getBatchNetworkId() internal override pure returns (string memory) {
55+
return 'OPETH-Batch';
56+
}
57+
}

test/walletSimple.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const EtcWalletSimple = artifacts.require('./EtcWalletSimple.sol');
3030
const CeloWalletSimple = artifacts.require('./CeloWalletSimple.sol');
3131
const PolygonWalletSimple = artifacts.require('./PolygonWalletSimple.sol');
3232
const ArbethWalletSimple = artifacts.require('./ArbethWalletSimple.sol');
33+
const OpethWalletSimple = artifacts.require('./OpethWalletSimple.sol');
3334
const Fail = artifacts.require('./Fail.sol');
3435
const GasGuzzler = artifacts.require('./GasGuzzler.sol');
3536
const GasHeavy = artifacts.require('./GasHeavy.sol');
@@ -87,6 +88,13 @@ const coins = [
8788
nativeBatchPrefix: 'ARBETH-Batch',
8889
tokenPrefix: 'ARBETH-ERC20',
8990
WalletSimple: ArbethWalletSimple
91+
},
92+
{
93+
name: 'Opeth',
94+
nativePrefix: 'OPETH',
95+
nativeBatchPrefix: 'OPETH-Batch',
96+
tokenPrefix: 'OPETH-ERC20',
97+
WalletSimple: OpethWalletSimple
9098
}
9199
];
92100

0 commit comments

Comments
 (0)