@skalenetwork/upgrade-tools 2.0.0-refactor.15 → 2.0.0-refactor.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BigNumberish, BytesLike, UnsignedTransaction } from "ethers";
|
|
2
|
+
import { ethers as RawEthers } from "ethers";
|
|
3
|
+
import { SafeToImaSubmitter } from "./safe-to-ima-submitter";
|
|
4
|
+
declare type FunctionCallStruct = {
|
|
5
|
+
receiver: string;
|
|
6
|
+
value: BigNumberish;
|
|
7
|
+
data: BytesLike;
|
|
8
|
+
};
|
|
9
|
+
interface Marionette extends RawEthers.Contract {
|
|
10
|
+
encodeFunctionCalls(functionCalls: FunctionCallStruct[]): Promise<BytesLike>;
|
|
11
|
+
}
|
|
12
|
+
export declare class SafeImaMarionetteSubmitter extends SafeToImaSubmitter {
|
|
13
|
+
marionette: Marionette;
|
|
14
|
+
submit(transactions: UnsignedTransaction[]): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SafeImaMarionetteSubmitter = void 0;
|
|
13
|
+
const hardhat_1 = require("hardhat");
|
|
14
|
+
const safe_to_ima_submitter_1 = require("./safe-to-ima-submitter");
|
|
15
|
+
class SafeImaMarionetteSubmitter extends safe_to_ima_submitter_1.SafeToImaSubmitter {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.marionette = new hardhat_1.ethers.Contract("0xD2c0DeFACe000000000000000000000000000000", new hardhat_1.ethers.utils.Interface([
|
|
19
|
+
{
|
|
20
|
+
"inputs": [
|
|
21
|
+
{
|
|
22
|
+
"components": [
|
|
23
|
+
{
|
|
24
|
+
"internalType": "address",
|
|
25
|
+
"name": "receiver",
|
|
26
|
+
"type": "address"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"internalType": "uint256",
|
|
30
|
+
"name": "value",
|
|
31
|
+
"type": "uint256"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"internalType": "bytes",
|
|
35
|
+
"name": "data",
|
|
36
|
+
"type": "bytes"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"internalType": "struct IMarionette.FunctionCall[]",
|
|
40
|
+
"name": "functionCalls",
|
|
41
|
+
"type": "tuple[]"
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"name": "encodeFunctionCalls",
|
|
45
|
+
"outputs": [
|
|
46
|
+
{
|
|
47
|
+
"internalType": "bytes",
|
|
48
|
+
"name": "",
|
|
49
|
+
"type": "bytes"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"stateMutability": "pure",
|
|
53
|
+
"type": "function"
|
|
54
|
+
}
|
|
55
|
+
]), hardhat_1.ethers.provider);
|
|
56
|
+
}
|
|
57
|
+
submit(transactions) {
|
|
58
|
+
const _super = Object.create(null, {
|
|
59
|
+
submit: { get: () => super.submit }
|
|
60
|
+
});
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
const functionCalls = [];
|
|
63
|
+
for (const transaction of transactions) {
|
|
64
|
+
functionCalls.push({
|
|
65
|
+
receiver: transaction.to ? transaction.to : hardhat_1.ethers.constants.AddressZero,
|
|
66
|
+
value: transaction.value ? transaction.value : 0,
|
|
67
|
+
data: (transaction.data ? transaction.data : "0x")
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
yield _super.submit.call(this, [
|
|
71
|
+
{
|
|
72
|
+
to: this.marionette.address,
|
|
73
|
+
data: yield this.marionette.encodeFunctionCalls(functionCalls)
|
|
74
|
+
}
|
|
75
|
+
]);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.SafeImaMarionetteSubmitter = SafeImaMarionetteSubmitter;
|