Skip to content

Commit

Permalink
Merge pull request #322 from kiroboio/develop
Browse files Browse the repository at this point in the history
fix(utils): improvements to FCT utils + getSimpleTransactionTrace fun…
  • Loading branch information
Brenzee authored Dec 21, 2023
2 parents 30c2814 + ba1918f commit 2ecdc48
Show file tree
Hide file tree
Showing 10 changed files with 230 additions and 512 deletions.
Binary file modified .DS_Store
Binary file not shown.
378 changes: 13 additions & 365 deletions scripts/tdata.json
Original file line number Diff line number Diff line change
@@ -1,367 +1,15 @@
{
"types": {
"EIP712Domain": [
{ "name": "name", "type": "string" },
{ "name": "version", "type": "string" },
{ "name": "chainId", "type": "uint256" },
{ "name": "verifyingContract", "type": "address" },
{ "name": "salt", "type": "bytes32" }
],
"Meta": [
{ "name": "name", "type": "string" },
{ "name": "app", "type": "string" },
{ "name": "app_version", "type": "string" },
{ "name": "builder", "type": "string" },
{ "name": "builder_address", "type": "address" },
{ "name": "domain", "type": "string" }
],
"Engine": [
{ "name": "selector", "type": "bytes4" },
{ "name": "version", "type": "bytes3" },
{ "name": "random_id", "type": "bytes3" },
{ "name": "eip712", "type": "bool" },
{ "name": "verifier", "type": "string" },
{ "name": "auth_enabled", "type": "bool" },
{ "name": "dry_run", "type": "bool" }
],
"Limits": [
{ "name": "valid_from", "type": "uint40" },
{ "name": "expires_at", "type": "uint40" },
{ "name": "gas_price_limit", "type": "uint64" },
{ "name": "purgeable", "type": "bool" },
{ "name": "blockable", "type": "bool" }
],
"Computed": [
{ "name": "index", "type": "uint256" },
{ "name": "value_1", "type": "uint256" },
{ "name": "op_1", "type": "string" },
{ "name": "value_2", "type": "uint256" },
{ "name": "op_2", "type": "string" },
{ "name": "value_3", "type": "uint256" },
{ "name": "op_3", "type": "string" },
{ "name": "value_4", "type": "uint256" },
{ "name": "overflow_protection", "type": "bool" }
],
"Validation": [
{ "name": "index", "type": "uint256" },
{ "name": "value_1", "type": "uint256" },
{ "name": "op", "type": "string" },
{ "name": "value_2", "type": "uint256" }
],
"transaction1": [
{ "name": "call", "type": "Call" },
{ "name": "address", "type": "address" }
],
"transaction2": [
{ "name": "call", "type": "Call" },
{ "name": "amount1", "type": "uint256" },
{ "name": "decimals1", "type": "uint256" },
{ "name": "amount2", "type": "uint256" },
{ "name": "decimals2", "type": "uint256" },
{ "name": "decimalsOut", "type": "uint256" }
],
"transaction3": [{ "name": "call", "type": "Call" }],
"transaction4": [
{ "name": "call", "type": "Call" },
{ "name": "amount1", "type": "uint256" },
{ "name": "decimals1", "type": "uint256" },
{ "name": "amount2", "type": "uint256" },
{ "name": "decimals2", "type": "uint256" },
{ "name": "decimalsOut", "type": "uint256" }
],
"transaction5": [{ "name": "call", "type": "Call" }],
"transaction6": [
{ "name": "call", "type": "Call" },
{ "name": "to", "type": "address" },
{ "name": "amount", "type": "uint256" }
],
"transaction7": [
{ "name": "call", "type": "Call" },
{ "name": "owner", "type": "address" }
],
"transaction8": [
{ "name": "call", "type": "Call" },
{ "name": "to", "type": "address" },
{ "name": "amount", "type": "uint256" }
],
"transaction9": [{ "name": "call", "type": "Call" }],
"BatchMultiSigCall": [
{ "name": "meta", "type": "Meta" },
{ "name": "engine", "type": "Engine" },
{ "name": "limits", "type": "Limits" },
{ "name": "computed_1", "type": "Computed" },
{ "name": "validation_1", "type": "Validation" },
{ "name": "validation_2", "type": "Validation" },
{ "name": "transaction_1", "type": "transaction1" },
{ "name": "transaction_2", "type": "transaction2" },
{ "name": "transaction_3", "type": "transaction3" },
{ "name": "transaction_4", "type": "transaction4" },
{ "name": "transaction_5", "type": "transaction5" },
{ "name": "transaction_6", "type": "transaction6" },
{ "name": "transaction_7", "type": "transaction7" },
{ "name": "transaction_8", "type": "transaction8" },
{ "name": "transaction_9", "type": "transaction9" }
],
"Call": [
{ "name": "call_index", "type": "uint16" },
{ "name": "payer_index", "type": "uint16" },
{ "name": "call_type", "type": "string" },
{ "name": "from", "type": "address" },
{ "name": "to", "type": "address" },
{ "name": "to_ens", "type": "string" },
{ "name": "value", "type": "uint256" },
{ "name": "gas_limit", "type": "uint32" },
{ "name": "permissions", "type": "uint16" },
{ "name": "validation", "type": "uint16" },
{ "name": "flow_control", "type": "string" },
{ "name": "returned_false_means_fail", "type": "bool" },
{ "name": "jump_on_success", "type": "uint16" },
{ "name": "jump_on_fail", "type": "uint16" },
{ "name": "method_interface", "type": "string" }
[
{ "type": "uint256", "value": "1" },
{
"type": "tuple[]",
"value": [
[
{ "type": "address", "value": "0xba232b47a7dDFCCc221916cf08Da03a4973D3A1D" },
{
"type": "uint256",
"value": "1234554321"
}
]
]
},
"primaryType": "BatchMultiSigCall",
"domain": {
"name": "FCT Controller",
"version": "1",
"chainId": 5,
"verifyingContract": "0x38B5249Ec6529F19aee7CE2c650CadD407a78Ed7",
"salt": "0x01004130db7959f5983e000038b5249ec6529f19aee7ce2c650cadd407a78ed7"
},
"message": {
"meta": {
"name": "Untitled-749803",
"app": "visual builder",
"app_version": "0.3.0",
"builder": "",
"builder_address": "0x0000000000000000000000000000000000000000",
"domain": "custom.kirobo.me"
},
"engine": {
"selector": "0x7d971612",
"version": "0x020101",
"random_id": "0xbd063e",
"eip712": true,
"verifier": "",
"auth_enabled": false,
"dry_run": false
},
"limits": {
"valid_from": "1702815075",
"expires_at": "1702815675",
"gas_price_limit": "3919666706",
"purgeable": false,
"blockable": true
},
"computed_1": {
"index": "1",
"value_1": "0xFD00000000000000000000000000000000000007",
"op_1": "/",
"value_2": "4",
"op_2": "+",
"value_3": "0",
"op_3": "+",
"value_4": "0",
"overflow_protection": true
},
"validation_1": {
"index": "1",
"value_1": "600000000000000000",
"op": "greater than",
"value_2": "0xFD00000000000000000000000000000000000004"
},
"validation_2": {
"index": "2",
"value_1": "0xFD00000000000000000000000000000000000007",
"op": "greater than",
"value_2": "2"
},
"transaction_1": {
"call": {
"call_index": 1,
"payer_index": 1,
"call_type": "view only",
"from": "0x235Ab23038540e6aA289f3f6D775F76600C5F9c9",
"to": "0x5ba1e12693dc8f9c48aad8770482f4739beed696",
"to_ens": "",
"value": "0",
"gas_limit": "91984",
"permissions": 0,
"validation": 0,
"flow_control": "continue on success, revert on fail",
"returned_false_means_fail": false,
"jump_on_success": 0,
"jump_on_fail": 0,
"method_interface": "getEthBalance(address)"
},
"address": "0x235Ab23038540e6aA289f3f6D775F76600C5F9c9"
},
"transaction_2": {
"call": {
"call_index": 2,
"payer_index": 2,
"call_type": "view only",
"from": "0x235Ab23038540e6aA289f3f6D775F76600C5F9c9",
"to": "0x254fb98E8943faF0F732477c4dE6Af7a1Dd7fD2D",
"to_ens": "",
"value": "0",
"gas_limit": "67664",
"permissions": 0,
"validation": 0,
"flow_control": "continue on success, revert on fail",
"returned_false_means_fail": false,
"jump_on_success": 0,
"jump_on_fail": 0,
"method_interface": "mul(uint256,uint256,uint256,uint256,uint256)"
},
"amount1": "0xFD00000000000000000000000000000000000001",
"decimals1": "18",
"amount2": "3000000000000000000",
"decimals2": "18",
"decimalsOut": "18"
},
"transaction_3": {
"call": {
"call_index": 3,
"payer_index": 3,
"call_type": "action",
"from": "0x235Ab23038540e6aA289f3f6D775F76600C5F9c9",
"to": "0xf88c0381d3a276e90725f46cb9cb3a6ceaaea500",
"to_ens": "",
"value": "0xFD00000000000000000000000000000000000002",
"gas_limit": "29950",
"permissions": 0,
"validation": 0,
"flow_control": "continue on success, continue on fail",
"returned_false_means_fail": false,
"jump_on_success": 3,
"jump_on_fail": 0,
"method_interface": ""
}
},
"transaction_4": {
"call": {
"call_index": 4,
"payer_index": 4,
"call_type": "view only",
"from": "0x235Ab23038540e6aA289f3f6D775F76600C5F9c9",
"to": "0x254fb98E8943faF0F732477c4dE6Af7a1Dd7fD2D",
"to_ens": "",
"value": "0",
"gas_limit": "67441",
"permissions": 0,
"validation": 1,
"flow_control": "continue on success, revert on fail",
"returned_false_means_fail": false,
"jump_on_success": 0,
"jump_on_fail": 0,
"method_interface": "div(uint256,uint256,uint256,uint256,uint256)"
},
"amount1": "0xFD00000000000000000000000000000000000001",
"decimals1": "18",
"amount2": "3000000000000000000",
"decimals2": "18",
"decimalsOut": "18"
},
"transaction_5": {
"call": {
"call_index": 5,
"payer_index": 5,
"call_type": "action",
"from": "0x235Ab23038540e6aA289f3f6D775F76600C5F9c9",
"to": "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",
"to_ens": "",
"value": "0xFD00000000000000000000000000000000000004",
"gas_limit": "78735",
"permissions": 0,
"validation": 0,
"flow_control": "continue on success, revert on fail",
"returned_false_means_fail": false,
"jump_on_success": 0,
"jump_on_fail": 0,
"method_interface": "deposit()"
}
},
"transaction_6": {
"call": {
"call_index": 6,
"payer_index": 6,
"call_type": "action",
"from": "0x235Ab23038540e6aA289f3f6D775F76600C5F9c9",
"to": "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",
"to_ens": "",
"value": "0",
"gas_limit": "80030",
"permissions": 0,
"validation": 0,
"flow_control": "stop on success, revert on fail",
"returned_false_means_fail": true,
"jump_on_success": 0,
"jump_on_fail": 0,
"method_interface": "transfer(address,uint256)"
},
"to": "0xf88c0381d3a276e90725f46cb9cb3a6ceaaea500",
"amount": "0xFD00000000000000000000000000000000000004"
},
"transaction_7": {
"call": {
"call_index": 7,
"payer_index": 7,
"call_type": "view only",
"from": "0x235Ab23038540e6aA289f3f6D775F76600C5F9c9",
"to": "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",
"to_ens": "",
"value": "0",
"gas_limit": "38400",
"permissions": 0,
"validation": 2,
"flow_control": "continue on success, continue on fail",
"returned_false_means_fail": false,
"jump_on_success": 0,
"jump_on_fail": 1,
"method_interface": "balanceOf(address)"
},
"owner": "0x235Ab23038540e6aA289f3f6D775F76600C5F9c9"
},
"transaction_8": {
"call": {
"call_index": 8,
"payer_index": 8,
"call_type": "action",
"from": "0x235Ab23038540e6aA289f3f6D775F76600C5F9c9",
"to": "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",
"to_ens": "",
"value": "0",
"gas_limit": "48400",
"permissions": 0,
"validation": 0,
"flow_control": "stop on success, revert on fail",
"returned_false_means_fail": true,
"jump_on_success": 0,
"jump_on_fail": 0,
"method_interface": "transfer(address,uint256)"
},
"to": "0xf88c0381d3a276e90725f46cb9cb3a6ceaaea500",
"amount": "0xFD00000000000000000000000000000000000007"
},
"transaction_9": {
"call": {
"call_index": 9,
"payer_index": 9,
"call_type": "action",
"from": "0x235Ab23038540e6aA289f3f6D775F76600C5F9c9",
"to": "0xf88c0381d3a276e90725f46cb9cb3a6ceaaea500",
"to_ens": "",
"value": "0xFE00000000000000000000000000000000000001",
"gas_limit": "29950",
"permissions": 0,
"validation": 0,
"flow_control": "stop on success, revert on fail",
"returned_false_means_fail": false,
"jump_on_success": 0,
"jump_on_fail": 0,
"method_interface": ""
}
}
}
}
]
10 changes: 1 addition & 9 deletions scripts/test.script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,8 @@ async function main() {
validations: ["582765e8-6085-4646-90d0-dabc7e45688e", "86a6c05e-d4c3-4ca1-b74f-7722c7fea949"],
});

// console.log(
// JSON.stringify(
// FCT.calls.map((call) => call.call),
// null,
// 2,
// ),
// );

const trace = await FCT.utils.getTransactionTrace({
tenderlyRpcUrl: process.env.TENDERLY_RPC_URL as string,
tenderlyRpcUrl: `https://goerli.gateway.tenderly.co/${process.env.TENDERLY_KEY as string}`,
txHash: "0x656493fdc44de7330edf9f3e7a6f4ab3e404716f624589070f030d6f17e2cc74",
});

Expand Down
Loading

0 comments on commit 2ecdc48

Please sign in to comment.