You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(define-read-only (symbol)
(contract-call?'ST3J2GVMMM2R07ZFBJDWTYEYAR8FZH5WKDTFJ9AHA.swapr symbol 'ST3J2GVMMM2R07ZFBJDWTYEYAR8FZH5WKDTFJ9AHA.plaid-token'ST3J2GVMMM2R07ZFBJDWTYEYAR8FZH5WKDTFJ9AHA.stx-token)
)
generates an error expecting read-only statements, detected a writing operation. (i.e. WriteAttemptedInReadOnly) when deploying, even if contract-call? is calling an other define-read-only function.
This should be allowed.
The latest proposal from the issue suggests adding a map to the trait definition with a field indicating if the function must be read-only:
(define-traitsrc20-trait
(
;; Transfer from the caller to a new principal
(transfer (principaluint) (responsebooluint))
;; the human readable name of the token
(name () (response (string-ascii32) uint) {read-only: true})
;; the ticker symbol, or empty if none
(symbol () (response (string-ascii32) uint) {read-only: true})
;; the number of decimals used, e.g. 6 would mean 1_000_000 represents 1 token
(decimals () (responseuintuint) {read-only: true})
;; the balance of the passed principal
(balance-of (principal) (responseuintuint) {read-only: true})
;; the current total supply (which does not need to be a constant)
(total-supply () (responseuintuint) {read-only: true})
)
)
The text was updated successfully, but these errors were encountered:
This is duplicated from stacks-network/stacks-core#1981:
The following code
generates an error
expecting read-only statements, detected a writing operation.
(i.e.WriteAttemptedInReadOnly
) when deploying, even ifcontract-call?
is calling an otherdefine-read-only
function.This should be allowed.
The latest proposal from the issue suggests adding a map to the trait definition with a field indicating if the function must be read-only:
The text was updated successfully, but these errors were encountered: