anchor-protocol / anchorcli Goto Github PK
View Code? Open in Web Editor NEWCommand-line interface for Anchor Protocol
License: Apache License 2.0
Command-line interface for Anchor Protocol
License: Apache License 2.0
Overseer contract must have the liquidate-collateral
message command. The following message must be added to overseer command:
When I use following command I got an error due to it's invalid option
request
$ anchorcli q overseer distribution-params
response
Error: Request failed with status code 500
at createError (/Users/ggomma/.nvm/versions/node/v12.15.0/lib/node_modules/@anchor-protocol/anchorcli/node_modules/axios/lib/core/createError.js:16:15)
at settle (/Users/ggomma/.nvm/versions/node/v12.15.0/lib/node_modules/@anchor-protocol/anchorcli/node_modules/axios/lib/core/settle.js:17:12)
at IncomingMessage.handleStreamEnd (/Users/ggomma/.nvm/versions/node/v12.15.0/lib/node_modules/@anchor-protocol/anchorcli/node_modules/axios/lib/adapters/http.js:260:11)
at IncomingMessage.emit (events.js:228:7)
at endReadableNT (_stream_readable.js:1185:12)
at processTicksAndRejections (internal/process/task_queues.js:81:21) {
config: {
url: '/wasm/contracts/terra1tmnqgvg567ypvsvk6rwsga3srp7e3lg6u0elp8/store',
method: 'get',
headers: { Accept: 'application/json', 'User-Agent': 'axios/0.21.1' },
params: { query_msg: '{"distribution_params":{}}' },
baseURL: 'https://lcd.terra.dev',
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
adapter: [Function: httpAdapter],
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
validateStatus: [Function: validateStatus],
data: undefined
},
request: ClientRequest {
_events: [Object: null prototype] {
socket: [Function],
abort: [Function],
aborted: [Function],
connect: [Function],
error: [Function],
timeout: [Function],
prefinish: [Function: requestOnPrefinish]
},
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: 'lcd.terra.dev',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 9,
connecting: false,
_hadError: false,
_parent: null,
_host: 'lcd.terra.dev',
_readableState: [ReadableState],
readable: true,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: [TLSWrap],
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular],
[Symbol(res)]: [TLSWrap],
[Symbol(asyncId)]: 3,
[Symbol(kHandle)]: [TLSWrap],
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(connect-options)]: [Object]
},
connection: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: 'lcd.terra.dev',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 9,
connecting: false,
_hadError: false,
_parent: null,
_host: 'lcd.terra.dev',
_readableState: [ReadableState],
readable: true,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: [TLSWrap],
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular],
[Symbol(res)]: [TLSWrap],
[Symbol(asyncId)]: 3,
[Symbol(kHandle)]: [TLSWrap],
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(connect-options)]: [Object]
},
_header: 'GET /wasm/contracts/terra1tmnqgvg567ypvsvk6rwsga3srp7e3lg6u0elp8/store?query_msg=%7B%22distribution_params%22:%7B%7D%7D HTTP/1.1\r\n' +
'Accept: application/json\r\n' +
'User-Agent: axios/0.21.1\r\n' +
'Host: lcd.terra.dev\r\n' +
'Connection: close\r\n' +
'\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: Agent {
_events: [Object: null prototype],
_eventsCount: 1,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object],
requests: {},
sockets: [Object],
freeSockets: {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
maxCachedSessions: 100,
_sessionCache: [Object]
},
socketPath: undefined,
method: 'GET',
insecureHTTPParser: undefined,
path: '/wasm/contracts/terra1tmnqgvg567ypvsvk6rwsga3srp7e3lg6u0elp8/store?query_msg=%7B%22distribution_params%22:%7B%7D%7D',
_ended: true,
res: IncomingMessage {
_readableState: [ReadableState],
readable: false,
_events: [Object: null prototype],
_eventsCount: 3,
_maxListeners: undefined,
socket: [TLSSocket],
connection: [TLSSocket],
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
headers: [Object],
rawHeaders: [Array],
trailers: {},
rawTrailers: [],
aborted: false,
upgrade: false,
url: '',
method: null,
statusCode: 500,
statusMessage: 'Internal Server Error',
client: [TLSSocket],
_consuming: false,
_dumped: false,
req: [Circular],
responseUrl: 'https://lcd.terra.dev/wasm/contracts/terra1tmnqgvg567ypvsvk6rwsga3srp7e3lg6u0elp8/store?query_msg=%7B%22distribution_params%22:%7B%7D%7D',
redirects: []
},
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
_redirectable: Writable {
_writableState: [WritableState],
writable: true,
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
_options: [Object],
_ended: true,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 0,
_requestBodyBuffers: [],
_onNativeResponse: [Function],
_currentRequest: [Circular],
_currentUrl: 'https://lcd.terra.dev/wasm/contracts/terra1tmnqgvg567ypvsvk6rwsga3srp7e3lg6u0elp8/store?query_msg=%7B%22distribution_params%22:%7B%7D%7D'
},
[Symbol(kNeedDrain)]: false,
[Symbol(isCorked)]: false,
[Symbol(kOutHeaders)]: [Object: null prototype] {
accept: [Array],
'user-agent': [Array],
host: [Array]
}
},
response: {
status: 500,
statusText: 'Internal Server Error',
headers: {
date: 'Wed, 21 Apr 2021 04:16:57 GMT',
'content-type': 'application/json',
'content-length': '217',
connection: 'close',
'set-cookie': [Array],
'access-control-allow-origin': '*',
'access-control-allow-methods': 'GET, POST, OPTIONS',
'access-control-allow-headers': 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range',
'access-control-expose-headers': 'Content-Length,Content-Range',
'cf-cache-status': 'DYNAMIC',
'cf-request-id': '09943e5125000012d6a0bb0000000001',
'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
server: 'cloudflare',
'cf-ray': '6433ccc83e1b12d6-ICN'
},
config: {
url: '/wasm/contracts/terra1tmnqgvg567ypvsvk6rwsga3srp7e3lg6u0elp8/store',
method: 'get',
headers: [Object],
params: [Object],
baseURL: 'https://lcd.terra.dev',
transformRequest: [Array],
transformResponse: [Array],
timeout: 0,
adapter: [Function: httpAdapter],
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
validateStatus: [Function: validateStatus],
data: undefined
},
request: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [TLSSocket],
connection: [TLSSocket],
_header: 'GET /wasm/contracts/terra1tmnqgvg567ypvsvk6rwsga3srp7e3lg6u0elp8/store?query_msg=%7B%22distribution_params%22:%7B%7D%7D HTTP/1.1\r\n' +
'Accept: application/json\r\n' +
'User-Agent: axios/0.21.1\r\n' +
'Host: lcd.terra.dev\r\n' +
'Connection: close\r\n' +
'\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
method: 'GET',
insecureHTTPParser: undefined,
path: '/wasm/contracts/terra1tmnqgvg567ypvsvk6rwsga3srp7e3lg6u0elp8/store?query_msg=%7B%22distribution_params%22:%7B%7D%7D',
_ended: true,
res: [IncomingMessage],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
_redirectable: [Writable],
[Symbol(kNeedDrain)]: false,
[Symbol(isCorked)]: false,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
data: {
error: 'contract query failed: parsing moneymarket::overseer::QueryMsg: unknown variant distribution_params
, expected one of config
, epoch_state
, whitelist
, collaterals
, all_collaterals
, borrow_limit
'
}
},
isAxiosError: true,
toJSON: [Function: toJSON]
}
If this error occurs due to lack of anchorcli help text.
Anchorcli needs to support Columbus 5 contracts and functionality, the following issues need to be addressed:
terracli
dependency to terrad
.When submitting a bit to the liquidation contract, the coin denomination must be uusd
:
$ ANCHORCLI_NETWORK=tequila-0004 anchorcli x \
> liquidation submit-bid \
> --collateral-token terra1u0t35drzyy0mujj8rkdyzhe264uls4ug3wdp3x \
> --premium-rate 0.25 \
> --coin 100usd \
> --from playground \
> --gas auto \
> --fees=1000000uusd
ERROR Error: invalid coin 'usd', MUST be uusd; use --verbose for more details
But when uusd
is specified, the number is parsed as usd
equivalent. In the example below, --coin 100uusd
becomes 100000000uusd
:
$ ANCHORCLI_NETWORK=tequila-0004 anchorcli x \
> liquidation submit-bid \
> --collateral-token terra1u0t35drzyy0mujj8rkdyzhe264uls4ug3wdp3x \
> --premium-rate 0.25 \
> --coin 100uusd \
> --from playground \
> --gas auto \
> --fees=1000000uusd
chainId: tequila-0004
msg:
type: wasm/MsgExecuteContract
value:
sender: SENDER_ADDRESS
contract: terra16vc4v9hhntswzkuunqhncs9yy30mqql3gxlqfe
execute_msg:
submit_bid:
collateral_token: terra1u0t35drzyy0mujj8rkdyzhe264uls4ug3wdp3x
premium_rate: "0.250000000000000000"
coins:
- denom: uusd
amount: "100000000"
fee:
gas: "138288"
amount:
- denom: uusd
amount: "1000000"
memo: ""
Or perhaps I'm missing something?
The current version of anchorcli
does not support beth functionalities. The following contract must be supported:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.