@eco-incorp/sauce 0.99.5 → 0.99.6
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/docs/concepts/architecture.md +4 -2
- package/docs/concepts/saucescript.md +19 -2
- package/docs/guides/builders-and-actions.md +4 -1
- package/docs/guides/compiling.md +5 -3
- package/docs/guides/intents.md +32 -2
- package/docs/guides/protocols-and-tokens.md +21 -1
- package/package.json +1 -1
- package/sdk/dist/embedded/skills.generated.js +6 -6
- package/sdk/dist/embedded/skills.generated.js.map +1 -1
- package/sdk/dist/embedded/sources.generated.js +2 -2
- package/sdk/dist/embedded/sources.generated.js.map +1 -1
- package/sdk/dist/plugin/index.d.ts +3 -2
- package/sdk/dist/plugin/index.d.ts.map +1 -1
- package/sdk/dist/plugin/index.js.map +1 -1
- package/sdk/dist/protocols/cbeth/functions.d.ts +2 -2
- package/sdk/dist/protocols/cbeth/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/cbeth/functions.js +4 -6
- package/sdk/dist/protocols/cbeth/functions.js.map +1 -1
- package/sdk/dist/protocols/crvusd/functions.d.ts +2 -2
- package/sdk/dist/protocols/crvusd/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/crvusd/functions.js +6 -6
- package/sdk/dist/protocols/erc20/functions.d.ts +3 -3
- package/sdk/dist/protocols/erc20/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/erc20/functions.js +6 -9
- package/sdk/dist/protocols/erc20/functions.js.map +1 -1
- package/sdk/dist/protocols/frax/functions.d.ts +2 -2
- package/sdk/dist/protocols/frax/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/frax/functions.js +6 -6
- package/sdk/dist/protocols/gho/functions.d.ts +2 -2
- package/sdk/dist/protocols/gho/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/gho/functions.js +4 -6
- package/sdk/dist/protocols/gho/functions.js.map +1 -1
- package/sdk/dist/protocols/liquity-v2/functions.d.ts +2 -2
- package/sdk/dist/protocols/liquity-v2/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/liquity-v2/functions.js +4 -6
- package/sdk/dist/protocols/liquity-v2/functions.js.map +1 -1
- package/sdk/dist/recipes/cctp-split.sauce.ts +3 -1
- package/sdk/dist/recipes/plain-transfer.sauce.ts +3 -0
- package/sdk/dist/routes/ast-walk.d.ts +4 -0
- package/sdk/dist/routes/ast-walk.d.ts.map +1 -1
- package/sdk/dist/routes/ast-walk.js +9 -2
- package/sdk/dist/routes/ast-walk.js.map +1 -1
- package/sdk/dist/routes/chain-exports.generated.d.ts.map +1 -1
- package/sdk/dist/routes/chain-exports.generated.js.map +1 -1
- package/sdk/dist/routes/index.d.ts +2 -2
- package/sdk/dist/routes/index.d.ts.map +1 -1
- package/sdk/dist/routes/index.js +1 -1
- package/sdk/dist/routes/index.js.map +1 -1
- package/sdk/dist/routes/intent-sugar.d.ts.map +1 -1
- package/sdk/dist/routes/intent-sugar.js +40 -23
- package/sdk/dist/routes/intent-sugar.js.map +1 -1
- package/sdk/dist/routes/sauce-route.d.ts.map +1 -1
- package/sdk/dist/routes/sauce-route.js +26 -23
- package/sdk/dist/routes/sauce-route.js.map +1 -1
- package/sdk/dist/routes/source-globals.generated.d.ts +7 -3
- package/sdk/dist/routes/source-globals.generated.d.ts.map +1 -1
- package/sdk/dist/routes/token-registry.d.ts.map +1 -1
- package/sdk/dist/routes/token-registry.js +6 -1
- package/sdk/dist/routes/token-registry.js.map +1 -1
- package/sdk/dist/routes/token-rewrite.d.ts +63 -28
- package/sdk/dist/routes/token-rewrite.d.ts.map +1 -1
- package/sdk/dist/routes/token-rewrite.js +390 -122
- package/sdk/dist/routes/token-rewrite.js.map +1 -1
- package/sdk/dist/token/api.d.ts +7 -4
- package/sdk/dist/token/api.d.ts.map +1 -1
- package/sdk/dist/token/api.js.map +1 -1
- package/sdk/dist/token/evm.js +2 -2
- package/sdk/dist/token/index.d.ts +3 -3
- package/sdk/dist/token/index.js +3 -3
- package/sdk/src/protocols/cbeth/functions.ts +4 -6
- package/sdk/src/protocols/crvusd/functions.ts +6 -6
- package/sdk/src/protocols/erc20/functions.ts +6 -9
- package/sdk/src/protocols/frax/functions.ts +6 -6
- package/sdk/src/protocols/gho/functions.ts +4 -6
- package/sdk/src/protocols/liquity-v2/functions.ts +4 -6
- package/sdk/src/skills/cbeth.md +4 -6
- package/sdk/src/skills/crvusd.md +6 -6
- package/sdk/src/skills/erc20.md +8 -10
- package/sdk/src/skills/frax.md +6 -6
- package/sdk/src/skills/gho.md +4 -6
- package/sdk/src/skills/liquity-v2.md +4 -6
package/sdk/dist/token/api.d.ts
CHANGED
|
@@ -37,13 +37,16 @@ export interface TokenCall {
|
|
|
37
37
|
*
|
|
38
38
|
* Route-body calls are positional (`Token(a).approve(spender, amt)`) where the runtime
|
|
39
39
|
* [`TokenApi`] takes a spec object, because the body is compiled to Sauce bytecode rather than
|
|
40
|
-
* executed: `token-rewrite.ts#rewriteTokenFactory`
|
|
41
|
-
*
|
|
42
|
-
*
|
|
40
|
+
* executed: `token-rewrite.ts#rewriteTokenFactory` lowers each write to `@sauce/token`'s function
|
|
41
|
+
* of the same name, which has OpenZeppelin `SafeERC20` semantics, and each read to `IERC20.at`,
|
|
42
|
+
* before the compiler sees it. These signatures are what let a **typed closure** body typecheck on
|
|
43
|
+
* the way there. The writes return nothing: they revert the program unless the token accepted
|
|
44
|
+
* them. Nothing calls these at run time, which is why they live here rather than on `TokenApi`.
|
|
43
45
|
*/
|
|
44
46
|
export interface TokenBinding {
|
|
45
47
|
transfer(to: AddressInput, amount: bigint): void;
|
|
46
48
|
approve(spender: AddressInput, amount: bigint): void;
|
|
49
|
+
transferFrom(from: AddressInput, to: AddressInput, amount: bigint): void;
|
|
47
50
|
balanceOf(owner: AddressInput): bigint;
|
|
48
51
|
}
|
|
49
52
|
/**
|
|
@@ -52,7 +55,7 @@ export interface TokenBinding {
|
|
|
52
55
|
*
|
|
53
56
|
* Deliberately NOT on `TokenApi` itself: the runtime `Token` value is a frozen object and is not
|
|
54
57
|
* callable, so typing it as callable would promise something that throws. It describes what is
|
|
55
|
-
* legal in a route BODY, where the call is rewritten
|
|
58
|
+
* legal in a route BODY, where the call is rewritten before compiling and never survives to run.
|
|
56
59
|
*/
|
|
57
60
|
export interface TokenFactory {
|
|
58
61
|
(address: AddressInput): TokenBinding;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/token/api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAsB,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAC;AAgBpD,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACvB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,uEAAuE;IACvE,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC;IACpC,yGAAyG;IACzG,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC;IACvC,yEAAyE;IACzE,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC;IACxC,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,gBAAgB,CAAC;IACrD,qGAAqG;IACrG,MAAM,IAAI;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jB,oBAAoB;CACrB,CAAC,CAAC"}
|
package/sdk/dist/token/evm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The ERC20 arm — statement/expression builders for the universal token interface's EVM lowering.
|
|
3
|
-
*
|
|
4
|
-
* `swap/source.ts`/`deposit/source.ts` already emit
|
|
3
|
+
* The writes go through `safe.ts` (OpenZeppelin `SafeERC20`); the read is a typed call against the
|
|
4
|
+
* engine-vendored `IERC20` artifact, the shape `swap/source.ts`/`deposit/source.ts` already emit.
|
|
5
5
|
*/
|
|
6
6
|
import { formatAddressField } from "../deposit/format.js";
|
|
7
7
|
import { toAddressBigint, toAmountBigint } from "./params.js";
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* `sdk/src/token/source.ts` for the per-target emission seam and `sdk/src/token/api.ts` for the
|
|
13
13
|
* `Token`/`TokenCall` builder shape.
|
|
14
14
|
*
|
|
15
|
-
* Two arms, chosen per call (not per accessor): the ERC20 arm (`evm.ts`) emits
|
|
16
|
-
* `
|
|
17
|
-
*
|
|
15
|
+
* Two arms, chosen per call (not per accessor): the ERC20 arm (`evm.ts`) emits the writes with
|
|
16
|
+
* OpenZeppelin `SafeERC20` semantics through `safe.ts`, and the `balanceOf` read as a typed
|
|
17
|
+
* `IERC20.at(token).balanceOf(...)` binding; the SPL arm (`svm.ts`) emits `svm.call(program, accounts,
|
|
18
18
|
* accounts)` against the SPL Token program, reusing the `svmSettleSource` idiom
|
|
19
19
|
* (`accountData`/`accountUint`, the `le8` u64 byteswap helper, `TransferChecked`/`ApproveChecked`).
|
|
20
20
|
* The two arms are NOT interchangeable at compile time — the compiler rejects a contract binding on
|
package/sdk/dist/token/index.js
CHANGED
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* `sdk/src/token/source.ts` for the per-target emission seam and `sdk/src/token/api.ts` for the
|
|
13
13
|
* `Token`/`TokenCall` builder shape.
|
|
14
14
|
*
|
|
15
|
-
* Two arms, chosen per call (not per accessor): the ERC20 arm (`evm.ts`) emits
|
|
16
|
-
* `
|
|
17
|
-
*
|
|
15
|
+
* Two arms, chosen per call (not per accessor): the ERC20 arm (`evm.ts`) emits the writes with
|
|
16
|
+
* OpenZeppelin `SafeERC20` semantics through `safe.ts`, and the `balanceOf` read as a typed
|
|
17
|
+
* `IERC20.at(token).balanceOf(...)` binding; the SPL arm (`svm.ts`) emits `svm.call(program, accounts,
|
|
18
18
|
* accounts)` against the SPL Token program, reusing the `svmSettleSource` idiom
|
|
19
19
|
* (`accountData`/`accountUint`, the `le8` u64 byteswap helper, `TransferChecked`/`ApproveChecked`).
|
|
20
20
|
* The two arms are NOT interchangeable at compile time — the compiler rejects a contract binding on
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
export const transfer = `
|
|
2
|
-
import {
|
|
2
|
+
import { transfer } from "@sauce/token";
|
|
3
3
|
|
|
4
4
|
function main(cbethAddress: Address, to: Address, amount: Uint256): Uint256 {
|
|
5
|
-
|
|
6
|
-
cbeth.transfer(to, amount);
|
|
5
|
+
transfer(cbethAddress, to, amount);
|
|
7
6
|
return 1;
|
|
8
7
|
}
|
|
9
8
|
`;
|
|
10
9
|
|
|
11
10
|
export const approve = `
|
|
12
|
-
import {
|
|
11
|
+
import { approve } from "@sauce/token";
|
|
13
12
|
|
|
14
13
|
function main(cbethAddress: Address, spender: Address, amount: Uint256): Uint256 {
|
|
15
|
-
|
|
16
|
-
cbeth.approve(spender, amount);
|
|
14
|
+
approve(cbethAddress, spender, amount);
|
|
17
15
|
return 1;
|
|
18
16
|
}
|
|
19
17
|
`;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
export const transfer = `
|
|
2
|
-
import {
|
|
2
|
+
import { transfer } from "@sauce/token";
|
|
3
3
|
|
|
4
4
|
function main(crvusdAddress: Address, to: Address, amount: Uint256): Uint256 {
|
|
5
|
-
|
|
6
|
-
return
|
|
5
|
+
transfer(crvusdAddress, to, amount);
|
|
6
|
+
return 1;
|
|
7
7
|
}
|
|
8
8
|
`;
|
|
9
9
|
|
|
10
10
|
export const approve = `
|
|
11
|
-
import {
|
|
11
|
+
import { approve } from "@sauce/token";
|
|
12
12
|
|
|
13
13
|
function main(crvusdAddress: Address, spender: Address, amount: Uint256): Uint256 {
|
|
14
|
-
|
|
15
|
-
return
|
|
14
|
+
approve(crvusdAddress, spender, amount);
|
|
15
|
+
return 1;
|
|
16
16
|
}
|
|
17
17
|
`;
|
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
export const transfer = `
|
|
2
|
-
import {
|
|
2
|
+
import { transfer } from "@sauce/token";
|
|
3
3
|
|
|
4
4
|
function main(token: Address, to: Address, amount: Uint256): Uint256 {
|
|
5
|
-
|
|
6
|
-
t.transfer(to, amount);
|
|
5
|
+
transfer(token, to, amount);
|
|
7
6
|
return 1;
|
|
8
7
|
}
|
|
9
8
|
`;
|
|
10
9
|
|
|
11
10
|
export const approve = `
|
|
12
|
-
import {
|
|
11
|
+
import { approve } from "@sauce/token";
|
|
13
12
|
|
|
14
13
|
function main(token: Address, spender: Address, amount: Uint256): Uint256 {
|
|
15
|
-
|
|
16
|
-
t.approve(spender, amount);
|
|
14
|
+
approve(token, spender, amount);
|
|
17
15
|
return 1;
|
|
18
16
|
}
|
|
19
17
|
`;
|
|
20
18
|
|
|
21
19
|
export const transferFrom = `
|
|
22
|
-
import {
|
|
20
|
+
import { transferFrom } from "@sauce/token";
|
|
23
21
|
|
|
24
22
|
function main(token: Address, from: Address, to: Address, amount: Uint256): Uint256 {
|
|
25
|
-
|
|
26
|
-
t.transferFrom(from, to, amount);
|
|
23
|
+
transferFrom(token, from, to, amount);
|
|
27
24
|
return 1;
|
|
28
25
|
}
|
|
29
26
|
`;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
export const transfer = `
|
|
2
|
-
import {
|
|
2
|
+
import { transfer } from "@sauce/token";
|
|
3
3
|
|
|
4
4
|
function main(fraxAddress: Address, to: Address, amount: Uint256): Uint256 {
|
|
5
|
-
|
|
6
|
-
return
|
|
5
|
+
transfer(fraxAddress, to, amount);
|
|
6
|
+
return 1;
|
|
7
7
|
}
|
|
8
8
|
`;
|
|
9
9
|
|
|
10
10
|
export const approve = `
|
|
11
|
-
import {
|
|
11
|
+
import { approve } from "@sauce/token";
|
|
12
12
|
|
|
13
13
|
function main(fraxAddress: Address, spender: Address, amount: Uint256): Uint256 {
|
|
14
|
-
|
|
15
|
-
return
|
|
14
|
+
approve(fraxAddress, spender, amount);
|
|
15
|
+
return 1;
|
|
16
16
|
}
|
|
17
17
|
`;
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
export const transfer = `
|
|
2
|
-
import {
|
|
2
|
+
import { transfer } from "@sauce/token";
|
|
3
3
|
|
|
4
4
|
function main(ghoAddress: Address, to: Address, amount: Uint256): Uint256 {
|
|
5
|
-
|
|
6
|
-
gho.transfer(to, amount);
|
|
5
|
+
transfer(ghoAddress, to, amount);
|
|
7
6
|
return 1;
|
|
8
7
|
}
|
|
9
8
|
`;
|
|
10
9
|
|
|
11
10
|
export const approve = `
|
|
12
|
-
import {
|
|
11
|
+
import { approve } from "@sauce/token";
|
|
13
12
|
|
|
14
13
|
function main(ghoAddress: Address, spender: Address, amount: Uint256): Uint256 {
|
|
15
|
-
|
|
16
|
-
gho.approve(spender, amount);
|
|
14
|
+
approve(ghoAddress, spender, amount);
|
|
17
15
|
return 1;
|
|
18
16
|
}
|
|
19
17
|
`;
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
export const transfer = `
|
|
2
|
-
import {
|
|
2
|
+
import { transfer } from "@sauce/token";
|
|
3
3
|
|
|
4
4
|
function main(boldAddress: Address, to: Address, amount: Uint256): Uint256 {
|
|
5
|
-
|
|
6
|
-
bold.transfer(to, amount);
|
|
5
|
+
transfer(boldAddress, to, amount);
|
|
7
6
|
return 1;
|
|
8
7
|
}
|
|
9
8
|
`;
|
|
10
9
|
|
|
11
10
|
export const approve = `
|
|
12
|
-
import {
|
|
11
|
+
import { approve } from "@sauce/token";
|
|
13
12
|
|
|
14
13
|
function main(boldAddress: Address, spender: Address, amount: Uint256): Uint256 {
|
|
15
|
-
|
|
16
|
-
bold.approve(spender, amount);
|
|
14
|
+
approve(boldAddress, spender, amount);
|
|
17
15
|
return 1;
|
|
18
16
|
}
|
|
19
17
|
`;
|
package/sdk/src/skills/cbeth.md
CHANGED
|
@@ -21,18 +21,16 @@ import { protocolInfo, deployments, sauceFunctions } from "@eco-incorp/sauce/pro
|
|
|
21
21
|
|
|
22
22
|
```typescript
|
|
23
23
|
// Transfer cbETH
|
|
24
|
-
import {
|
|
24
|
+
import { transfer } from "@sauce/token";
|
|
25
25
|
function main(cbethAddress: Address, to: Address, amount: Uint256): Uint256 {
|
|
26
|
-
|
|
27
|
-
cbeth.transfer(to, amount);
|
|
26
|
+
transfer(cbethAddress, to, amount);
|
|
28
27
|
return 1;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
// Approve cbETH
|
|
32
|
-
import {
|
|
31
|
+
import { approve } from "@sauce/token";
|
|
33
32
|
function main(cbethAddress: Address, spender: Address, amount: Uint256): Uint256 {
|
|
34
|
-
|
|
35
|
-
cbeth.approve(spender, amount);
|
|
33
|
+
approve(cbethAddress, spender, amount);
|
|
36
34
|
return 1;
|
|
37
35
|
}
|
|
38
36
|
```
|
package/sdk/src/skills/crvusd.md
CHANGED
|
@@ -21,17 +21,17 @@ import { protocolInfo, deployments, sauceFunctions } from "@eco-incorp/sauce/pro
|
|
|
21
21
|
|
|
22
22
|
```typescript
|
|
23
23
|
// Transfer crvUSD
|
|
24
|
-
import {
|
|
24
|
+
import { transfer } from "@sauce/token";
|
|
25
25
|
function main(crvusdAddress: Address, to: Address, amount: Uint256): Uint256 {
|
|
26
|
-
|
|
27
|
-
return
|
|
26
|
+
transfer(crvusdAddress, to, amount);
|
|
27
|
+
return 1;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
// Approve crvUSD spender
|
|
31
|
-
import {
|
|
31
|
+
import { approve } from "@sauce/token";
|
|
32
32
|
function main(crvusdAddress: Address, spender: Address, amount: Uint256): Uint256 {
|
|
33
|
-
|
|
34
|
-
return
|
|
33
|
+
approve(crvusdAddress, spender, amount);
|
|
34
|
+
return 1;
|
|
35
35
|
}
|
|
36
36
|
```
|
|
37
37
|
|
package/sdk/src/skills/erc20.md
CHANGED
|
@@ -24,26 +24,23 @@ import { protocolInfo, deployments, sauceFunctions } from "@eco-incorp/sauce/pro
|
|
|
24
24
|
|
|
25
25
|
```typescript
|
|
26
26
|
// Transfer tokens
|
|
27
|
-
import {
|
|
27
|
+
import { transfer } from "@sauce/token";
|
|
28
28
|
function main(token: Address, to: Address, amount: Uint256): Uint256 {
|
|
29
|
-
|
|
30
|
-
t.transfer(to, amount);
|
|
29
|
+
transfer(token, to, amount);
|
|
31
30
|
return 1;
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
// Approve spender
|
|
35
|
-
import {
|
|
34
|
+
import { approve } from "@sauce/token";
|
|
36
35
|
function main(token: Address, spender: Address, amount: Uint256): Uint256 {
|
|
37
|
-
|
|
38
|
-
t.approve(spender, amount);
|
|
36
|
+
approve(token, spender, amount);
|
|
39
37
|
return 1;
|
|
40
38
|
}
|
|
41
39
|
|
|
42
40
|
// Transfer from (requires prior approval)
|
|
43
|
-
import {
|
|
41
|
+
import { transferFrom } from "@sauce/token";
|
|
44
42
|
function main(token: Address, from: Address, to: Address, amount: Uint256): Uint256 {
|
|
45
|
-
|
|
46
|
-
t.transferFrom(from, to, amount);
|
|
43
|
+
transferFrom(token, from, to, amount);
|
|
47
44
|
return 1;
|
|
48
45
|
}
|
|
49
46
|
|
|
@@ -97,5 +94,6 @@ function main(to: Address, amount: Uint256): Uint256 {
|
|
|
97
94
|
- approve before transferFrom: spender must be approved by the owner first
|
|
98
95
|
- Common pattern: approve max (type(uint256).max) for DeFi interactions, or use exact amounts for security
|
|
99
96
|
- decimals varies: most tokens use 18, USDC/USDT use 6, WBTC uses 8
|
|
100
|
-
- Some tokens (USDT) do not return bool from transfer/approve
|
|
97
|
+
- Some tokens (USDT) do not return bool from transfer/approve. The writes above are `@sauce/token`'s, which follow OpenZeppelin SafeERC20: empty returndata is accepted from a contract, a `false` return reverts, and `approve` resets a non-zero allowance to zero first. They return nothing, since a refused write reverts the program
|
|
98
|
+
- `ERC20ABI.at(token).transfer(...)` is the raw ABI call and is NOT SafeERC20: it reverts on a token that returns nothing and accepts one that returns `false`. Use it only when that is what you mean
|
|
101
99
|
- The storageTransfer example demonstrates how to implement ERC-20 logic entirely in SauceScript using storage operations
|
package/sdk/src/skills/frax.md
CHANGED
|
@@ -21,17 +21,17 @@ import { protocolInfo, deployments, sauceFunctions } from "@eco-incorp/sauce/pro
|
|
|
21
21
|
|
|
22
22
|
```typescript
|
|
23
23
|
// Transfer FRAX
|
|
24
|
-
import {
|
|
24
|
+
import { transfer } from "@sauce/token";
|
|
25
25
|
function main(fraxAddress: Address, to: Address, amount: Uint256): Uint256 {
|
|
26
|
-
|
|
27
|
-
return
|
|
26
|
+
transfer(fraxAddress, to, amount);
|
|
27
|
+
return 1;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
// Approve FRAX spender
|
|
31
|
-
import {
|
|
31
|
+
import { approve } from "@sauce/token";
|
|
32
32
|
function main(fraxAddress: Address, spender: Address, amount: Uint256): Uint256 {
|
|
33
|
-
|
|
34
|
-
return
|
|
33
|
+
approve(fraxAddress, spender, amount);
|
|
34
|
+
return 1;
|
|
35
35
|
}
|
|
36
36
|
```
|
|
37
37
|
|
package/sdk/src/skills/gho.md
CHANGED
|
@@ -21,18 +21,16 @@ import { protocolInfo, deployments, sauceFunctions } from "@eco-incorp/sauce/pro
|
|
|
21
21
|
|
|
22
22
|
```typescript
|
|
23
23
|
// Transfer GHO
|
|
24
|
-
import {
|
|
24
|
+
import { transfer } from "@sauce/token";
|
|
25
25
|
function main(ghoAddress: Address, to: Address, amount: Uint256): Uint256 {
|
|
26
|
-
|
|
27
|
-
gho.transfer(to, amount);
|
|
26
|
+
transfer(ghoAddress, to, amount);
|
|
28
27
|
return 1;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
// Approve GHO spender
|
|
32
|
-
import {
|
|
31
|
+
import { approve } from "@sauce/token";
|
|
33
32
|
function main(ghoAddress: Address, spender: Address, amount: Uint256): Uint256 {
|
|
34
|
-
|
|
35
|
-
gho.approve(spender, amount);
|
|
33
|
+
approve(ghoAddress, spender, amount);
|
|
36
34
|
return 1;
|
|
37
35
|
}
|
|
38
36
|
```
|
|
@@ -21,18 +21,16 @@ import { protocolInfo, deployments, sauceFunctions } from "@eco-incorp/sauce/pro
|
|
|
21
21
|
|
|
22
22
|
```typescript
|
|
23
23
|
// Transfer BOLD
|
|
24
|
-
import {
|
|
24
|
+
import { transfer } from "@sauce/token";
|
|
25
25
|
function main(boldAddress: Address, to: Address, amount: Uint256): Uint256 {
|
|
26
|
-
|
|
27
|
-
bold.transfer(to, amount);
|
|
26
|
+
transfer(boldAddress, to, amount);
|
|
28
27
|
return 1;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
// Approve BOLD spender
|
|
32
|
-
import {
|
|
31
|
+
import { approve } from "@sauce/token";
|
|
33
32
|
function main(boldAddress: Address, spender: Address, amount: Uint256): Uint256 {
|
|
34
|
-
|
|
35
|
-
bold.approve(spender, amount);
|
|
33
|
+
approve(boldAddress, spender, amount);
|
|
36
34
|
return 1;
|
|
37
35
|
}
|
|
38
36
|
```
|