How to provide constants on forc v0.37.0? forc.toml constants outdated on forc v0.37.0

Hi guys!
I have the same predicate code as OTC swap in my project

It uses the same way to define constants in forc.toml as OTC sway

But after updating my forc to v0.37.0 it does not build with an error

error
  --> /Users/alexey/projects/fuel/limit_orders/services/predicate-orders-builder/order-template/src/main.sw:28:16
   |
26 | 
27 |     const ASK_TOKEN = ContractId {
28 |         value: ASK_TOKEN_CONFIG,
   |                ^^^^^^^^^^^^^^^^ Variable "ASK_TOKEN_CONFIG" does not exist in this scope.
29 |     };
30 |     const RECEIVER = Address::from(RECEIVER_CONFIG);
   |
____

error
  --> /Users/alexey/projects/fuel/limit_orders/services/predicate-orders-builder/order-template/src/main.sw:30:36
   |
28 | 
29 |     };
30 |     const RECEIVER = Address::from(RECEIVER_CONFIG);
   |                                    ^^^^^^^^^^^^^^^ Variable "RECEIVER_CONFIG" does not exist in this scope.
31 | 
32 |     // Check if the transaction contains a single input coin from the receiver, to cancel their own order (in addition to this predicate)
   |
____

error
  --> /Users/alexey/projects/fuel/limit_orders/services/predicate-orders-builder/order-template/src/main.sw:58:36
   |
56 | 
57 |     // Evaluate the predicate
58 |     (to == RECEIVER) && (amount == ASK_AMOUNT) && (asset_id == ASK_TOKEN)
   |                                    ^^^^^^^^^^ Variable "ASK_AMOUNT" does not exist in this scope.
59 | }
   |
____

  Aborting due to 3 errors.
Error: Failed to compile swap-predicate

How to provide constants on forc v0.37.0?

2 Likes

The definition constants in Forc.toml are no longer supported. Instead, configurable constants defined in a configurable block should be used. These constants do not change throughout the execution of a Sway program, but they can be changed at “configuration time” using the Rust SDK for example .

But how I can build a predicate with configurable constants?
I understand we need to provide configurable constants to the contract during deployment, but there is no any deployment in predicats