@orbs-network/spot 2.3.4 → 2.4.0
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.
- package/README.md +146 -136
- package/index.html +16 -10
- package/index.js +1 -1
- package/package.json +11 -18
- package/SKILL.md +0 -63
- package/manifest.json +0 -63
- package/mcp/stdio.mjs +0 -219
- package/out/00_DeployWM.s.sol/DeployWM.json +0 -1
- package/out/00_UpdateWMWhitelist.s.sol/UpdateWMWhitelist.json +0 -1
- package/out/01_DeployRepermit.s.sol/DeployRepermit.json +0 -1
- package/out/02_DeployCosigner.s.sol/DeployCosigner.json +0 -1
- package/out/03_DeployReactor.s.sol/DeployReactor.json +0 -1
- package/out/04_DeployExecutor.s.sol/DeployExecutor.json +0 -1
- package/out/05_DeployRefinery.s.sol/DeployRefinery.json +0 -1
- package/out/06_DeployDefaultAdapter.s.sol/DeployDefaultAdapter.json +0 -1
- package/out/06_DeployDelegatingAdapter.s.sol/DeployDelegatingAdapter.json +0 -1
- package/out/06_DeployP2Adapter.s.sol/DeployP2Adapter.json +0 -1
- package/out/06_DeployParaswapAdapter.s.sol/DeployParaswapAdapter.json +0 -1
- package/out/06_DeployUniversalAdapter.s.sol/DeployUniversalAdapter.json +0 -1
- package/out/AbstractSigner.sol/AbstractSigner.json +0 -1
- package/out/Address.sol/Address.json +0 -1
- package/out/Base.sol/CommonBase.json +0 -1
- package/out/Base.sol/ScriptBase.json +0 -1
- package/out/Base.sol/TestBase.json +0 -1
- package/out/BaseTest.sol/BaseTest.json +0 -1
- package/out/Bytes.sol/Bytes.json +0 -1
- package/out/Constants.sol/Constants.json +0 -1
- package/out/Context.sol/Context.json +0 -1
- package/out/CosignatureLib.sol/CosignatureLib.json +0 -1
- package/out/CosignatureLib.t.sol/CosignatureLibTest.json +0 -1
- package/out/Cosigner.sol/Cosigner.json +0 -1
- package/out/Cosigner.t.sol/CosignerTest.json +0 -1
- package/out/Cosigner.t.sol/CosignerWrapper.json +0 -1
- package/out/CosignerIntegration.t.sol/CosignerIntegrationTest.json +0 -1
- package/out/DefaultDexAdapter.sol/DefaultDexAdapter.json +0 -1
- package/out/DefaultDexAdapter.t.sol/DefaultDexAdapterTest.json +0 -1
- package/out/DelegatingAdapter.sol/DelegatingAdapter.json +0 -1
- package/out/DelegatingAdapter.t.sol/DelegatingAdapterTest.json +0 -1
- package/out/DelegatingAdapter.t.sol/MockDelegateTarget.json +0 -1
- package/out/ECDSA.sol/ECDSA.json +0 -1
- package/out/EIP712.sol/EIP712.json +0 -1
- package/out/ERC20.sol/ERC20.json +0 -1
- package/out/ERC20Mock.sol/ERC20Mock.json +0 -1
- package/out/ERC20Mock6Decimals.sol/ERC20Mock6Decimals.json +0 -1
- package/out/EpochLib.sol/EpochLib.json +0 -1
- package/out/EpochLib.t.sol/EpochLibTest.json +0 -1
- package/out/Errors.sol/Errors.json +0 -1
- package/out/ExclusivityOverrideLib.sol/ExclusivityOverrideLib.json +0 -1
- package/out/ExclusivityOverrideLib.t.sol/ExclusivityCaller.json +0 -1
- package/out/ExclusivityOverrideLib.t.sol/ExclusivityLibTest.json +0 -1
- package/out/Executor.sol/Executor.json +0 -1
- package/out/Executor.t.sol/ExecutorTest.json +0 -1
- package/out/FeeOnTransferERC20Mock.sol/FeeOnTransferERC20Mock.json +0 -1
- package/out/ICommitteeSync.sol/ICommitteeSync.json +0 -1
- package/out/IEIP712.sol/IEIP712.json +0 -1
- package/out/IERC1271.sol/IERC1271.json +0 -1
- package/out/IERC1363.sol/IERC1363.json +0 -1
- package/out/IERC165.sol/IERC165.json +0 -1
- package/out/IERC20.sol/IERC20.json +0 -1
- package/out/IERC20Metadata.sol/IERC20Metadata.json +0 -1
- package/out/IERC5267.sol/IERC5267.json +0 -1
- package/out/IERC7913.sol/IERC7913SignatureVerifier.json +0 -1
- package/out/IExchangeAdapter.sol/IExchangeAdapter.json +0 -1
- package/out/IMulticall3.sol/IMulticall3.json +0 -1
- package/out/IParaswapAugustus.sol/IParaswapAugustus.json +0 -1
- package/out/IPermit2.sol/IPermit2.json +0 -1
- package/out/IReactor.sol/IReactor.json +0 -1
- package/out/IReactorCallback.sol/IReactorCallback.json +0 -1
- package/out/IWM.sol/IWM.json +0 -1
- package/out/IWrappedNative.sol/IWrappedNative.json +0 -1
- package/out/LowLevelCall.sol/LowLevelCall.json +0 -1
- package/out/Math.sol/Math.json +0 -1
- package/out/MessageHashUtils.sol/MessageHashUtils.json +0 -1
- package/out/MockCommitteeSync.sol/MockCommitteeSync.json +0 -1
- package/out/MockDexRouter.sol/MockDexRouter.json +0 -1
- package/out/MockParaswap.sol/MockParaswapAugustus.json +0 -1
- package/out/MockParaswap.sol/MockTokenTransferProxy.json +0 -1
- package/out/MockPermit2.sol/MockPermit2.json +0 -1
- package/out/MockReactor.sol/MockReactor.json +0 -1
- package/out/Multicall3Lib.sol/Multicall3Lib.json +0 -1
- package/out/OrderLib.sol/OrderLib.json +0 -1
- package/out/OrderReactor.E2E.t.sol/OrderReactorE2ETest.json +0 -1
- package/out/OrderReactor.sol/OrderReactor.json +0 -1
- package/out/OrderReactorPause.t.sol/OrderReactorPauseTest.json +0 -1
- package/out/OrderReactorPause.t.sol/SimpleCallback.json +0 -1
- package/out/OrderValidationLib.Fuzz.t.sol/OrderValidationLibFuzzTest.json +0 -1
- package/out/OrderValidationLib.sol/OrderValidationLib.json +0 -1
- package/out/OrderValidationLib.t.sol/OrderValidationLibTest.json +0 -1
- package/out/Ownable.sol/Ownable.json +0 -1
- package/out/Ownable2Step.sol/Ownable2Step.json +0 -1
- package/out/P2DexAdapter.sol/P2DexAdapter.json +0 -1
- package/out/P2DexAdapter.t.sol/P2DexAdapterTest.json +0 -1
- package/out/Panic.sol/Panic.json +0 -1
- package/out/ParaswapDexAdapter.sol/ParaswapDexAdapter.json +0 -1
- package/out/ParaswapDexAdapter.t.sol/ParaswapDexAdapterTest.json +0 -1
- package/out/Pausable.sol/Pausable.json +0 -1
- package/out/RePermit.sol/RePermit.json +0 -1
- package/out/RePermit.t.sol/RePermitTest.json +0 -1
- package/out/RePermitLib.sol/RePermitLib.json +0 -1
- package/out/ReentrancyGuard.sol/ReentrancyGuard.json +0 -1
- package/out/Refinery.sol/Refinery.json +0 -1
- package/out/Refinery.t.sol/PayableTarget.json +0 -1
- package/out/Refinery.t.sol/RefineryTest.json +0 -1
- package/out/ResolutionLib.Fuzz.t.sol/ResolutionLibFuzzTest.json +0 -1
- package/out/ResolutionLib.sol/ResolutionLib.json +0 -1
- package/out/ResolutionLib.t.sol/ResolutionLibTest.json +0 -1
- package/out/SafeCast.sol/SafeCast.json +0 -1
- package/out/SafeERC20.sol/SafeERC20.json +0 -1
- package/out/Script.sol/Script.json +0 -1
- package/out/SettlementLib.sol/SettlementLib.json +0 -1
- package/out/SettlementLib.t.sol/SettlementLibTest.json +0 -1
- package/out/SettlementLib.t.sol/SettlementWrapper.json +0 -1
- package/out/Settler.sol/Settler.json +0 -1
- package/out/Settler.t.sol/SettlerTest.json +0 -1
- package/out/ShortStrings.sol/ShortStrings.json +0 -1
- package/out/SignatureChecker.sol/SignatureChecker.json +0 -1
- package/out/SignedMath.sol/SignedMath.json +0 -1
- package/out/StdAssertions.sol/StdAssertions.json +0 -1
- package/out/StdChains.sol/StdChains.json +0 -1
- package/out/StdCheats.sol/StdCheats.json +0 -1
- package/out/StdCheats.sol/StdCheatsSafe.json +0 -1
- package/out/StdConstants.sol/StdConstants.json +0 -1
- package/out/StdError.sol/stdError.json +0 -1
- package/out/StdInvariant.sol/StdInvariant.json +0 -1
- package/out/StdJson.sol/stdJson.json +0 -1
- package/out/StdMath.sol/stdMath.json +0 -1
- package/out/StdStorage.sol/stdStorage.json +0 -1
- package/out/StdStorage.sol/stdStorageSafe.json +0 -1
- package/out/StdStyle.sol/StdStyle.json +0 -1
- package/out/StdToml.sol/stdToml.json +0 -1
- package/out/StdUtils.sol/StdUtils.json +0 -1
- package/out/StorageSlot.sol/StorageSlot.json +0 -1
- package/out/Strings.sol/Strings.json +0 -1
- package/out/SurplusLib.sol/SurplusLib.json +0 -1
- package/out/SurplusLib.t.sol/SurplusHarness.json +0 -1
- package/out/SurplusLib.t.sol/SurplusLibTest.json +0 -1
- package/out/SwapAdapter.sol/SwapAdapterMock.json +0 -1
- package/out/Test.sol/Test.json +0 -1
- package/out/TokenLib.sol/TokenLib.json +0 -1
- package/out/TokenLib.t.sol/TokenLibHarness.json +0 -1
- package/out/TokenLib.t.sol/TokenLibTest.json +0 -1
- package/out/USDTMock.sol/USDTMock.json +0 -1
- package/out/UniversalAdapter.sol/UniversalAdapter.json +0 -1
- package/out/UniversalAdapter.t.sol/UniversalAdapterTest.json +0 -1
- package/out/Vm.sol/Vm.json +0 -1
- package/out/Vm.sol/VmSafe.json +0 -1
- package/out/WM.sol/WM.json +0 -1
- package/out/WM.t.sol/WMTest.json +0 -1
- package/out/WMAllowed.sol/WMAllowed.json +0 -1
- package/out/WrappedNativeMock.sol/WrappedNativeMock.json +0 -1
- package/out/build-info/621c6e28e002a5dd.json +0 -1
- package/out/build-info/7683d39d37ddee4a.json +0 -1
- package/out/console.sol/console.json +0 -1
- package/out/draft-IERC6093.sol/IERC1155Errors.json +0 -1
- package/out/draft-IERC6093.sol/IERC20Errors.json +0 -1
- package/out/draft-IERC6093.sol/IERC721Errors.json +0 -1
- package/out/safeconsole.sol/safeconsole.json +0 -1
- package/server.json +0 -21
- package/skill/assets/repermit.skeleton.json +0 -195
- package/skill/assets/token-addressbook.md +0 -97
- package/skill/assets/web3-sign-and-submit.example.js +0 -111
- package/skill/references/01-quickstart.md +0 -12
- package/skill/references/02-params.md +0 -39
- package/skill/references/03-sign.md +0 -6
- package/skill/references/04-patterns.md +0 -12
- package/skill/scripts/order.js +0 -1202
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
# Common Token Addressbook
|
|
2
|
-
|
|
3
|
-
## Ethereum (`1`)
|
|
4
|
-
|
|
5
|
-
1. `weth`: `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`
|
|
6
|
-
2. `wbtc`: `0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599`
|
|
7
|
-
3. `usdc`: `0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`
|
|
8
|
-
4. `usdt`: `0xdAC17F958D2ee523a2206206994597C13D831ec7`
|
|
9
|
-
5. `dai`: `0x6B175474E89094C44Da98b954EedeAC495271d0F`
|
|
10
|
-
6. `lusd`: `0x5f98805A4E8be255a32880FDeC7F6728C6568bA0`
|
|
11
|
-
7. `orbs`: `0xff56Cc6b1E6dEd347aA0B7676C85AB0B3D08B0FA`
|
|
12
|
-
|
|
13
|
-
## BNB Chain (`56`)
|
|
14
|
-
|
|
15
|
-
1. `wbnb`: `0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c`
|
|
16
|
-
2. `btcb`: `0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c`
|
|
17
|
-
3. `wbtc`: `0x0555e30da8f98308edb960aa94c0db47230d2b9c`
|
|
18
|
-
4. `usdc`: `0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d`
|
|
19
|
-
5. `usdt`: `0x55d398326f99059fF775485246999027B3197955`
|
|
20
|
-
6. `usd1`: `0x8d0d000ee44948fc98c9b98a4fa4921476f08b0d`
|
|
21
|
-
7. `dai`: `0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3`
|
|
22
|
-
8. `busd`: `0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56`
|
|
23
|
-
9. `weth`: `0x2170Ed0880ac9A755fd29B2688956BD959F933F8`
|
|
24
|
-
10. `orbs`: `0x43a8cab15D06d3a5fE5854D714C37E7E9246F170`
|
|
25
|
-
|
|
26
|
-
## Polygon (`137`)
|
|
27
|
-
|
|
28
|
-
1. `wmatic`: `0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270`
|
|
29
|
-
2. `wbtc`: `0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6`
|
|
30
|
-
3. `usdc`: `0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359`
|
|
31
|
-
4. `usdc.e`: `0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174`
|
|
32
|
-
5. `usdt`: `0xc2132D05D31c914a87C6611C10748AEb04B58e8F`
|
|
33
|
-
6. `dai`: `0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063`
|
|
34
|
-
7. `weth`: `0x7ceb23fd6bc0add59e62ac25578270cff1b9f619`
|
|
35
|
-
8. `orbs`: `0x614389EaAE0A6821DC49062D56BDA3d9d45Fa2ff`
|
|
36
|
-
|
|
37
|
-
## Arbitrum One (`42161`)
|
|
38
|
-
|
|
39
|
-
1. `weth`: `0x82af49447d8a07e3bd95bd0d56f35241523fbab1`
|
|
40
|
-
2. `wbtc`: `0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f`
|
|
41
|
-
3. `usdc`: `0xaf88d065e77c8cC2239327C5EDb3A432268e5831`
|
|
42
|
-
4. `usdt`: `0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9`
|
|
43
|
-
5. `dai`: `0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1`
|
|
44
|
-
6. `arb`: `0x912CE59144191C1204E64559FE8253a0e49E6548`
|
|
45
|
-
7. `orbs`: `0xf3C091ed43de9c270593445163a41A876A0bb3dd`
|
|
46
|
-
|
|
47
|
-
## Optimism (`10`)
|
|
48
|
-
|
|
49
|
-
1. `weth`: `0x4200000000000000000000000000000000000006`
|
|
50
|
-
2. `wbtc`: `0x68f180fcCe6836688e9084f035309E29Bf0A2095`
|
|
51
|
-
3. `usdc`: `0x7F5c764cBc14f9669B88837ca1490cCa17c31607`
|
|
52
|
-
4. `usdt`: `0x94b008aA00579c1307B0EF2c499aD98a8ce58e58`
|
|
53
|
-
5. `dai`: `0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1`
|
|
54
|
-
6. `op`: `0x4200000000000000000000000000000000000042`
|
|
55
|
-
|
|
56
|
-
## Avalanche (`43114`)
|
|
57
|
-
|
|
58
|
-
1. `wavax`: `0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7`
|
|
59
|
-
2. `wbtc`: `0x50b7545627a5162F82A992c33b87aDc75187B218`
|
|
60
|
-
3. `usdc`: `0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664`
|
|
61
|
-
4. `usdt`: `0xc7198437980c041c805A1EDcbA50c1Ce5db95118`
|
|
62
|
-
5. `dai`: `0xd586E7F844cEa2F87f50152665BCbc2C279D8d70`
|
|
63
|
-
6. `weth`: `0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB`
|
|
64
|
-
7. `orbs`: `0x340fE1D898ECCAad394e2ba0fC1F93d27c7b717A`
|
|
65
|
-
|
|
66
|
-
## Base (`8453`)
|
|
67
|
-
|
|
68
|
-
1. `weth`: `0x4200000000000000000000000000000000000006`
|
|
69
|
-
2. `usdc`: `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`
|
|
70
|
-
3. `dai`: `0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb`
|
|
71
|
-
4. `cbbtc`: `0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf`
|
|
72
|
-
|
|
73
|
-
## Mantle (`5000`)
|
|
74
|
-
|
|
75
|
-
1. `wmnt`: `0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8`
|
|
76
|
-
2. `weth`: `0xdeaddeaddeaddeaddeaddeaddeaddeaddead1111`
|
|
77
|
-
3. `usdc`: `0x09Bc4E0D864854c6aFB6eB9A9cdF58aC190D0dF9`
|
|
78
|
-
4. `usdt`: `0x201eba5cc46D216Ce6DC03F6a759e8E766e956Ae`
|
|
79
|
-
5. `usdt0`: `0x779Ded0c9e1022225f8E0630b35a9b54bE713736`
|
|
80
|
-
|
|
81
|
-
## Linea (`59144`)
|
|
82
|
-
|
|
83
|
-
1. `weth`: `0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f`
|
|
84
|
-
2. `wbtc`: `0x3aAB2285ddcDdaD8edf438C1bAB47e1a9D05a9b4`
|
|
85
|
-
3. `usdc`: `0x176211869cA2b568f2A7D4EE941E073a821EE1ff`
|
|
86
|
-
4. `usdt`: `0xA219439258ca9da29E9Cc4cE5596924745e12B93`
|
|
87
|
-
5. `dai`: `0x4AF15ec2A0BD43Db75dd04E62FAA3B8EF36b00d5`
|
|
88
|
-
|
|
89
|
-
## Sonic (`146`)
|
|
90
|
-
|
|
91
|
-
1. `ws`: `0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38`
|
|
92
|
-
2. `wbtc`: `0x0555E30da8f98308EdB960aa94C0Db47230d2B9c`
|
|
93
|
-
3. `weth`: `0x50c42dEAcD8Fc9773493ED674b675bE577f2634b`
|
|
94
|
-
4. `usdc`: `0x29219dd400f2Bf60E5a23d13Be72B486D4038894`
|
|
95
|
-
5. `usdt`: `0x6047828dc181963ba44974801FF68e538dA5eaF9`
|
|
96
|
-
6. `sfc`: `0xFC00FACE00000000000000000000000000000000`
|
|
97
|
-
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
// Example only. This flow uses eth_signTypedData_v4 via an injected provider,
|
|
2
|
-
// but any framework that signs the same prepared.typedData payload is valid.
|
|
3
|
-
|
|
4
|
-
import Web3 from "web3";
|
|
5
|
-
|
|
6
|
-
const DEPOSIT_DATA = "0xd0e30db0";
|
|
7
|
-
const ERC20_ABI = [
|
|
8
|
-
{
|
|
9
|
-
constant: true,
|
|
10
|
-
inputs: [
|
|
11
|
-
{ name: "owner", type: "address" },
|
|
12
|
-
{ name: "spender", type: "address" },
|
|
13
|
-
],
|
|
14
|
-
name: "allowance",
|
|
15
|
-
outputs: [{ name: "", type: "uint256" }],
|
|
16
|
-
type: "function",
|
|
17
|
-
},
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
export async function approveSignAndSubmitOrder({
|
|
21
|
-
prepared,
|
|
22
|
-
account,
|
|
23
|
-
provider = window.ethereum,
|
|
24
|
-
wrappedNative,
|
|
25
|
-
nativeInputAmount,
|
|
26
|
-
sendApproval = true,
|
|
27
|
-
}) {
|
|
28
|
-
const web3 = new Web3(provider);
|
|
29
|
-
const normalizedAccount = account.toLowerCase();
|
|
30
|
-
const expectedSigner = prepared.signing.signer.toLowerCase();
|
|
31
|
-
|
|
32
|
-
// The EIP-712 signer must be the same address that created the order.
|
|
33
|
-
if (normalizedAccount !== expectedSigner) {
|
|
34
|
-
throw new Error(
|
|
35
|
-
`signer mismatch: expected ${prepared.signing.signer}, got ${account}`
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Native input is not supported by the order itself.
|
|
40
|
-
// If the input starts as the chain's native asset, wrap it to WNATIVE first.
|
|
41
|
-
if (
|
|
42
|
-
nativeInputAmount != null &&
|
|
43
|
-
nativeInputAmount !== "0" &&
|
|
44
|
-
nativeInputAmount !== "0x0"
|
|
45
|
-
) {
|
|
46
|
-
if (!wrappedNative) {
|
|
47
|
-
throw new Error("wrappedNative is required when nativeInputAmount is set");
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
await web3.eth.sendTransaction({
|
|
51
|
-
from: account,
|
|
52
|
-
to: wrappedNative,
|
|
53
|
-
data: DEPOSIT_DATA,
|
|
54
|
-
value: nativeInputAmount,
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (prepared.approval && sendApproval) {
|
|
59
|
-
// The skill helper is RPC-agnostic, so the caller should use its own
|
|
60
|
-
// provider access to avoid resending the same infinite approval.
|
|
61
|
-
const token = new web3.eth.Contract(ERC20_ABI, prepared.approval.tx.to);
|
|
62
|
-
const allowance = BigInt(
|
|
63
|
-
await token.methods
|
|
64
|
-
.allowance(account, prepared.approval.spender)
|
|
65
|
-
.call()
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
if (allowance < BigInt(prepared.approval.amount)) {
|
|
69
|
-
await web3.eth.sendTransaction({
|
|
70
|
-
from: account,
|
|
71
|
-
to: prepared.approval.tx.to,
|
|
72
|
-
data: prepared.approval.tx.data,
|
|
73
|
-
value: prepared.approval.tx.value,
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// This example uses eth_signTypedData_v4, but any equivalent EIP-712 signer works.
|
|
79
|
-
const signature = await provider.request({
|
|
80
|
-
method: "eth_signTypedData_v4",
|
|
81
|
-
params: [account, JSON.stringify(prepared.typedData)],
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
// Submit the order payload plus the returned signature to the relay endpoint.
|
|
85
|
-
const response = await fetch(prepared.submit.url, {
|
|
86
|
-
method: "POST",
|
|
87
|
-
headers: {
|
|
88
|
-
"content-type": "application/json",
|
|
89
|
-
},
|
|
90
|
-
body: JSON.stringify({
|
|
91
|
-
...prepared.submit.body,
|
|
92
|
-
signature,
|
|
93
|
-
}),
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
const text = await response.text();
|
|
97
|
-
let body;
|
|
98
|
-
|
|
99
|
-
try {
|
|
100
|
-
body = JSON.parse(text);
|
|
101
|
-
} catch {
|
|
102
|
-
body = text;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return {
|
|
106
|
-
ok: response.ok,
|
|
107
|
-
status: response.status,
|
|
108
|
-
signature,
|
|
109
|
-
body,
|
|
110
|
-
};
|
|
111
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# Quickstart
|
|
2
|
-
|
|
3
|
-
1. Required fields: `chainId`, `swapper`, `input.token`, `input.amount`, `output.token`.
|
|
4
|
-
2. Choose the intended order shape before preparing: market, limit, stop-loss, take-profit, delayed-start, or chunked/TWAP.
|
|
5
|
-
3. Prepare the order with the helper.
|
|
6
|
-
4. If approval is needed, send `prepared.approval.tx` to approve `RePermit`.
|
|
7
|
-
5. The skill helper does not read allowance onchain. The calling agent or app should use its own RPC or provider access to compare the current ERC-20 allowance against `prepared.approval.amount`, send that infinite approval only when allowance is lower, and then leave the infinite approval in place with no reset.
|
|
8
|
-
6. Sign `prepared.typedData` as the `swapper`.
|
|
9
|
-
7. Submit the signed order.
|
|
10
|
-
8. Query the order by `swapper` or `hash`.
|
|
11
|
-
9. Watch until terminal state. Default polling is every 5 seconds, timeout `0` means no timeout, and transient network errors are retried automatically.
|
|
12
|
-
10. When measuring a fill onchain, sum both transfers to the swapper: the main fill and the surplus refund. Measuring only the main fill undercounts actual output by up to the slippage tolerance.
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# Params
|
|
2
|
-
|
|
3
|
-
Use this file for field semantics, defaults, units, and validation.
|
|
4
|
-
|
|
5
|
-
1. Required: `chainId`, `swapper`, `input.token`, `input.amount`, `output.token`.
|
|
6
|
-
2. Optional: `input.maxAmount`, `nonce`, `start`, `deadline`, `epoch`, `slippage`, `output.limit`, `output.triggerLower`, `output.triggerUpper`, `output.recipient`.
|
|
7
|
-
3. `input.amount` is the fixed per-chunk size. `input.maxAmount` is the total requested size. If omitted, it defaults to `input.amount`. If it is not divisible by `input.amount`, the helper rounds it down to a whole number of chunks.
|
|
8
|
-
4. `output.limit`, `output.triggerLower`, and `output.triggerUpper` are output-token amounts per chunk, encoded in the output token's decimals.
|
|
9
|
-
5. Future `start` delays the first fill. `epoch` is the delay between chunks, but it is not exact: each chunk can fill anywhere inside its epoch window, only once. Large `epoch` is not a delayed order by itself.
|
|
10
|
-
6. Chunked orders should use `epoch > 0`; with `epoch = 0`, only the first chunk can fill.
|
|
11
|
-
7. Defaults:
|
|
12
|
-
- `input.maxAmount = input.amount`
|
|
13
|
-
- `nonce = now`
|
|
14
|
-
- `start = now`
|
|
15
|
-
- `epoch = 0` for single orders, `60` for chunked orders
|
|
16
|
-
- `deadline = start + 300 + chunkCount * epoch`
|
|
17
|
-
- `slippage = 500`
|
|
18
|
-
- `output.limit = 0`
|
|
19
|
-
- `output.recipient = swapper`
|
|
20
|
-
8. Higher slippage is still protected by oracle pricing and offchain executors.
|
|
21
|
-
9. `output.recipient` is dangerous to change away from `swapper`.
|
|
22
|
-
10. Native input is not supported. Wrap to WNATIVE first. Native output, including "back to native" orders, is supported directly with `output.token = 0x0000000000000000000000000000000000000000`.
|
|
23
|
-
11. Example:
|
|
24
|
-
|
|
25
|
-
```json
|
|
26
|
-
{
|
|
27
|
-
"chainId": 42161,
|
|
28
|
-
"swapper": "0x1111111111111111111111111111111111111111",
|
|
29
|
-
"input": {
|
|
30
|
-
"token": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
31
|
-
"amount": "1000000"
|
|
32
|
-
},
|
|
33
|
-
"output": {
|
|
34
|
-
"token": "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
|
|
35
|
-
"limit": "0"
|
|
36
|
-
},
|
|
37
|
-
"epoch": 3600
|
|
38
|
-
}
|
|
39
|
-
```
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
# Sign And Submit
|
|
2
|
-
|
|
3
|
-
1. Sign `prepared.typedData` with any EIP-712-capable wallet or library. The signer must equal `swapper`. `eth_signTypedData_v4` is only one example.
|
|
4
|
-
2. Submit with `--prepared <prepared.json|->` and exactly one signature mode: `--signature <0x...|json>`, `--signature-file <sig.txt|sig.json|->`, or `--r <0x...> --s <0x...> --v <0x...>`.
|
|
5
|
-
3. The helper accepts a full 65-byte signature, a JSON string, or JSON/object `r/s/v`.
|
|
6
|
-
4. Cancel trustlessly onchain by calling `RePermit.cancel([digest])` as the swapper for the signed RePermit digest.
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# Order Patterns
|
|
2
|
-
|
|
3
|
-
1. Market swap: `input.amount = input.maxAmount`, `output.limit = 0`.
|
|
4
|
-
2. Limit order: `input.amount = input.maxAmount`, `output.limit > 0`.
|
|
5
|
-
3. Stop-loss or take-profit: set `output.triggerLower` for stop-loss and/or `output.triggerUpper` for take-profit.
|
|
6
|
-
4. Delayed order: set future `start`.
|
|
7
|
-
5. Chunked or TWAP-style: set `input.amount < input.maxAmount`.
|
|
8
|
-
6. Time-spaced chunked order: set `epoch > 0`. For example, `epoch = 60` means one chunk can fill once anywhere inside each 60-second epoch window.
|
|
9
|
-
7. `N chunks`: use one TWAP order instead of manually submitting `N` separate orders. Use `input.maxAmount` as the requested total amount, set `input.amount = floor(total / N)`, and accept any rounded-down remainder as dust.
|
|
10
|
-
8. If timing is omitted for a chunked or TWAP order, `epoch` defaults to `60`. Single orders default to `0`.
|
|
11
|
-
9. Native output or back to native exposure: set `output.token = 0x0000000000000000000000000000000000000000`.
|
|
12
|
-
10. Best execution and oracle protection apply regardless of `output.limit`.
|