@wireio/stake 0.5.2 → 0.7.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/lib/stake.browser.js +284 -283
- package/lib/stake.browser.js.map +1 -1
- package/lib/stake.d.ts +37 -36
- package/lib/stake.js +287 -286
- package/lib/stake.js.map +1 -1
- package/lib/stake.m.js +284 -283
- package/lib/stake.m.js.map +1 -1
- package/package.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/liqEth.sol/LiqEthToken.dbg.json +1 -1
- package/src/assets/ethereum/ABI/liqEth/liqEth.sol/LiqEthToken.json +33 -2
- package/src/assets/ethereum/ABI/outpost/BAR.sol/BAR.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/BAR.sol/BAR.json +2 -18
- package/src/assets/ethereum/ABI/outpost/Depositor.sol/Depositor.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/Depositor.sol/Depositor.json +26 -42
- package/src/assets/ethereum/ABI/outpost/EthUsdPriceConsumer.sol/AggregatorV3Interface.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/EthUsdPriceConsumer.sol/EthUsdPriceConsumer.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/EthUsdPriceConsumer.sol/EthUsdPriceConsumer.json +2 -31
- package/src/assets/ethereum/ABI/outpost/OutpostErrors.sol/OutpostErrors.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/OutpostErrors.sol/OutpostErrors.json +2 -18
- package/src/assets/ethereum/ABI/outpost/Pool.sol/Pool.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/Pool.sol/Pool.json +2 -18
- package/src/assets/ethereum/ABI/outpost/Pretoken.sol/Pretoken.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/Pretoken.sol/Pretoken.json +2 -18
- package/src/assets/ethereum/ABI/outpost/ReceiptNFT.sol/ReceiptNFT.dbg.json +1 -1
- package/src/assets/ethereum/ABI/outpost/ReceiptNFT.sol/ReceiptNFT.json +2 -18
- package/src/assets/ethereum/ABI/token/ERC1155Token.sol/ERC1155Token.dbg.json +1 -1
- package/src/assets/ethereum/ABI/token/ERC1155Token.sol/ERC1155Token.json +2 -2
- package/src/assets/ethereum/ABI/token/ERC20Token.sol/ERC20Token.dbg.json +1 -1
- package/src/assets/ethereum/ABI/token/ERC20Token.sol/ERC20Token.json +2 -2
- package/src/assets/ethereum/ABI/token/ERC721Token.sol/ERC721Token.dbg.json +1 -1
- package/src/assets/ethereum/ABI/token/ERC721Token.sol/ERC721Token.json +2 -2
- package/src/networks/ethereum/contract.ts +24 -24
- package/src/networks/ethereum/ethereum.ts +14 -8
- package/src/networks/ethereum/utils.ts +103 -71
- package/src/networks/solana/solana.ts +160 -97
- package/src/networks/solana/utils.ts +58 -30
- package/src/staker.ts +2 -0
- package/src/types.ts +12 -11
|
@@ -442,8 +442,8 @@
|
|
|
442
442
|
"type": "function"
|
|
443
443
|
}
|
|
444
444
|
],
|
|
445
|
-
"bytecode": "0x60806040523480156200001157600080fd5b50604051806040016040528060098152602001682a32b9ba2a37b5b2b760b91b8152506040518060400160405280600381526020016205343560ec1b815250816000908162000061919062000504565b50600162000070828262000504565b505050620000863360006200008c60201b60201c565b620005d0565b6001600160a01b038216620000bc57604051633250574960e11b8152600060048201526024015b60405180910390fd5b6000620000cb838383620000ff565b90506001600160a01b03811615620000fa576040516339e3563760e11b815260006004820152602401620000b3565b505050565b6000828152600260205260408120546001600160a01b03908116908316156200012f576200012f818486620001fe565b6001600160a01b038116156200016f576200014e600085818062000268565b6001600160a01b038116600090815260036020526040902080546000190190555b6001600160a01b038516156200019f576001600160a01b0385166000908152600360205260409020805460010190555b60008481526002602052604080822080546001600160a01b0319166001600160a01b0389811691821790925591518793918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4949350505050565b6200020b83838362000396565b620000fa576001600160a01b0383166200023c57604051637e27328960e01b815260048101829052602401620000b3565b60405163177e802f60e01b81526001600160a01b038316600482015260248101829052604401620000b3565b80806200027d57506001600160a01b03821615155b156200036657600062000290846200041f565b90506001600160a01b03831615801590620002bd5750826001600160a01b0316816001600160a01b031614155b8015620002f057506001600160a01b0380821660009081526005602090815260408083209387168352929052205460ff16155b156200031b5760405163a9fbf51f60e01b81526001600160a01b0384166004820152602401620000b3565b8115620003645783856001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b5050600090815260046020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160a01b03831615801590620004175750826001600160a01b0316846001600160a01b03161480620003f257506001600160a01b0380851660009081526005602090815260408083209387168352929052205460ff165b806200041757506000828152600460205260409020546001600160a01b038481169116145b949350505050565b6000818152600260205260408120546001600160a01b0316806200045a57604051637e27328960e01b815260048101849052602401620000b3565b92915050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200048b57607f821691505b602082108103620004ac57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620000fa57600081815260208120601f850160051c81016020861015620004db5750805b601f850160051c820191505b81811015620004fc57828155600101620004e7565b505050505050565b81516001600160401b0381111562000520576200052062000460565b620005388162000531845462000476565b84620004b2565b602080601f831160018114620005705760008415620005575750858301515b600019600386901b1c1916600185901b178555620004fc565b600085815260208120601f198616915b82811015620005a15788860151825594840194600190910190840162000580565b5085821015620005c05787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b61124280620005e06000396000f3fe608060405234801561001057600080fd5b50600436106100df5760003560e01c80636352211e1161008c578063a22cb46511610066578063a22cb465146101c3578063b88d4fde146101d6578063c87b56dd146101e9578063e985e9c5146101fc57600080fd5b80636352211e1461018757806370a082311461019a57806395d89b41146101bb57600080fd5b8063095ea7b3116100bd578063095ea7b31461014c57806323b872dd1461016157806342842e0e1461017457600080fd5b806301ffc9a7146100e457806306fdde031461010c578063081812fc14610121575b600080fd5b6100f76100f2366004610e45565b610238565b60405190151581526020015b60405180910390f35b61011461031d565b6040516101039190610ed0565b61013461012f366004610ee3565b6103af565b6040516001600160a01b039091168152602001610103565b61015f61015a366004610f18565b6103d8565b005b61015f61016f366004610f42565b6103e7565b61015f610182366004610f42565b6104a9565b610134610195366004610ee3565b6104c9565b6101ad6101a8366004610f7e565b6104d4565b604051908152602001610103565b610114610535565b61015f6101d1366004610f99565b610544565b61015f6101e4366004611004565b61054f565b6101146101f7366004610ee3565b610566565b6100f761020a3660046110fe565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd0000000000000000000000000000000000000000000000000000000014806102cb57507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b8061031757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60606000805461032c90611131565b80601f016020809104026020016040519081016040528092919081815260200182805461035890611131565b80156103a55780601f1061037a576101008083540402835291602001916103a5565b820191906000526020600020905b81548152906001019060200180831161038857829003601f168201915b5050505050905090565b60006103ba826105db565b506000828152600460205260409020546001600160a01b0316610317565b6103e382823361062d565b5050565b6001600160a01b03821661042f576040517f64a0ae92000000000000000000000000000000000000000000000000000000008152600060048201526024015b60405180910390fd5b600061043c83833361063a565b9050836001600160a01b0316816001600160a01b0316146104a3576040517f64283d7b0000000000000000000000000000000000000000000000000000000081526001600160a01b0380861660048301526024820184905282166044820152606401610426565b50505050565b6104c48383836040518060200160405280600081525061054f565b505050565b6000610317826105db565b60006001600160a01b038216610519576040517f89c62b6400000000000000000000000000000000000000000000000000000000815260006004820152602401610426565b506001600160a01b031660009081526003602052604090205490565b60606001805461032c90611131565b6103e3338383610769565b61055a8484846103e7565b6104a38484848461083f565b6060610571826105db565b50600061058960408051602081019091526000815290565b905060008151116105a957604051806020016040528060008152506105d4565b806105b384610a02565b6040516020016105c4929190611184565b6040516020818303038152906040525b9392505050565b6000818152600260205260408120546001600160a01b031680610317576040517f7e27328900000000000000000000000000000000000000000000000000000000815260048101849052602401610426565b6104c48383836001610ac0565b6000828152600260205260408120546001600160a01b039081169083161561066757610667818486610c16565b6001600160a01b038116156106c357610684600085600080610ac0565b6001600160a01b038116600090815260036020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190555b6001600160a01b038516156106f2576001600160a01b0385166000908152600360205260409020805460010190555b60008481526002602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0389811691821790925591518793918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4949350505050565b6001600160a01b0382166107b4576040517f5b08ba180000000000000000000000000000000000000000000000000000000081526001600160a01b0383166004820152602401610426565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0383163b156104a3576040517f150b7a020000000000000000000000000000000000000000000000000000000081526001600160a01b0384169063150b7a029061089a9033908890879087906004016111b3565b6020604051808303816000875af19250505080156108f3575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526108f0918101906111ef565b60015b610975573d808015610921576040519150601f19603f3d011682016040523d82523d6000602084013e610926565b606091505b50805160000361096d576040517f64a0ae920000000000000000000000000000000000000000000000000000000081526001600160a01b0385166004820152602401610426565b805181602001fd5b7fffffffff0000000000000000000000000000000000000000000000000000000081167f150b7a0200000000000000000000000000000000000000000000000000000000146109fb576040517f64a0ae920000000000000000000000000000000000000000000000000000000081526001600160a01b0385166004820152602401610426565b5050505050565b60606000610a0f83610cac565b600101905060008167ffffffffffffffff811115610a2f57610a2f610fd5565b6040519080825280601f01601f191660200182016040528015610a59576020820181803683370190505b5090508181016020015b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8504945084610a6357509392505050565b8080610ad457506001600160a01b03821615155b15610bce576000610ae4846105db565b90506001600160a01b03831615801590610b105750826001600160a01b0316816001600160a01b031614155b8015610b4257506001600160a01b0380821660009081526005602090815260408083209387168352929052205460ff16155b15610b84576040517fa9fbf51f0000000000000000000000000000000000000000000000000000000081526001600160a01b0384166004820152602401610426565b8115610bcc5783856001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b5050600090815260046020526040902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b610c21838383610d8e565b6104c4576001600160a01b038316610c68576040517f7e27328900000000000000000000000000000000000000000000000000000000815260048101829052602401610426565b6040517f177e802f0000000000000000000000000000000000000000000000000000000081526001600160a01b038316600482015260248101829052604401610426565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310610cf5577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310610d21576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310610d3f57662386f26fc10000830492506010015b6305f5e1008310610d57576305f5e100830492506008015b6127108310610d6b57612710830492506004015b60648310610d7d576064830492506002015b600a83106103175760010192915050565b60006001600160a01b03831615801590610e0c5750826001600160a01b0316846001600160a01b03161480610de857506001600160a01b0380851660009081526005602090815260408083209387168352929052205460ff165b80610e0c57506000828152600460205260409020546001600160a01b038481169116145b949350505050565b7fffffffff0000000000000000000000000000000000000000000000000000000081168114610e4257600080fd5b50565b600060208284031215610e5757600080fd5b81356105d481610e14565b60005b83811015610e7d578181015183820152602001610e65565b50506000910152565b60008151808452610e9e816020860160208601610e62565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815260006105d46020830184610e86565b600060208284031215610ef557600080fd5b5035919050565b80356001600160a01b0381168114610f1357600080fd5b919050565b60008060408385031215610f2b57600080fd5b610f3483610efc565b946020939093013593505050565b600080600060608486031215610f5757600080fd5b610f6084610efc565b9250610f6e60208501610efc565b9150604084013590509250925092565b600060208284031215610f9057600080fd5b6105d482610efc565b60008060408385031215610fac57600080fd5b610fb583610efc565b915060208301358015158114610fca57600080fd5b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000806080858703121561101a57600080fd5b61102385610efc565b935061103160208601610efc565b925060408501359150606085013567ffffffffffffffff8082111561105557600080fd5b818701915087601f83011261106957600080fd5b81358181111561107b5761107b610fd5565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019083821181831017156110c1576110c1610fd5565b816040528281528a60208487010111156110da57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b6000806040838503121561111157600080fd5b61111a83610efc565b915061112860208401610efc565b90509250929050565b600181811c9082168061114557607f821691505b60208210810361117e577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60008351611196818460208801610e62565b8351908301906111aa818360208801610e62565b01949350505050565b60006001600160a01b038087168352808616602084015250836040830152608060608301526111e56080830184610e86565b9695505050505050565b60006020828403121561120157600080fd5b81516105d481610e1456fea2646970667358221220f01353e907bf32e618b272b375495d5c57e47c264dd1ba09828ba6800e20cae964736f6c63430008140033",
|
|
446
|
-
"deployedBytecode": "
|
|
445
|
+
"bytecode": "0x6080346103bf576040906001600160401b03818301818111838210176103a957835260098252602090682a32b9ba2a37b5b2b760b91b82840152835191848301838110838211176103a95785526003918284526205343560ec1b8285015284518181116103a9576000948554916001978884811c9416801561039f575b8685101461038b578190601f9485811161033d575b5086908583116001146102df5789926102d4575b505060001982881b1c191690881b1786555b80519283116102c05786548781811c911680156102b6575b858210146102a25790818385949311610252575b50849183116001146101f45786926101e9575b505060001982851b1c191690851b1784555b33156101d1578280526002808252858420546001600160a01b03169485151593919291846101a6575b3386528252868520908154019055838052528382203360018060a01b03198254161790558184519333907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8380a4610191578251610b3090816103c58239f35b6339e3563760e11b8252600482015260249150fd5b6004835287862080546001600160a01b03191690558686528083528786208054600019019055610131565b8451633250574960e11b815260048101849052602490fd5b0151905038806100f6565b8787528487208894509190601f198416885b8782821061023c5750508411610224575b505050811b018455610108565b015160001983871b60f8161c19169055388080610217565b8385015186558b97909501949384019301610206565b909192508787528487208380860160051c820192878710610299575b9186958b929594930160051c01915b82811061028b5750506100e3565b8981558695508a910161027d565b9250819261026e565b634e487b7160e01b87526022600452602487fd5b90607f16906100cf565b634e487b7160e01b86526041600452602486fd5b0151905038806100a5565b898052878a208b94509190601f1984168b5b8a828210610327575050841161030f575b505050811b0186556100b7565b0151600019838a1b60f8161c19169055388080610302565b8385015186558e979095019493840193016102f1565b9091508880528689208580850160051c820192898610610382575b918c91869594930160051c01915b828110610374575050610091565b8b81558594508c9101610366565b92508192610358565b634e487b7160e01b88526022600452602488fd5b93607f169361007c565b634e487b7160e01b600052604160045260246000fd5b600080fdfe608060408181526004918236101561001657600080fd5b600092833560e01c91826301ffc9a7146106505750816306fdde0314610583578163081812fc14610547578163095ea7b31461046a57816323b872dd1461045257816342842e0e146104295781636352211e146103f857816370a08231146103a357816395d89b4114610286578163a22cb465146101e4578163b88d4fde14610156578163c87b56dd14610104575063e985e9c5146100b457600080fd5b3461010057806003193601126101005760ff816020936100d26106fb565b6100da610716565b6001600160a01b0391821683526005875283832091168252855220549151911615158152f35b5080fd5b838334610100576020366003190112610100576101246101529335610abf565b5081815161013181610761565b5280519161013e83610761565b8252519182916020835260208301906106bb565b0390f35b919050346101e05760803660031901126101e0576101726106fb565b61017a610716565b846064359467ffffffffffffffff8611610100573660238701121561010057850135946101b26101a9876107b5565b95519586610793565b858552366024878301011161010057856101dd9660246020930183880137850101526044359161096a565b80f35b8280fd5b919050346101e057806003193601126101e0576101ff6106fb565b9060243591821515809303610282576001600160a01b031692831561026d5750338452600560205280842083855260205280842060ff1981541660ff8416179055519081527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a380f35b836024925191630b61174360e31b8352820152fd5b8480fd5b8284346103a057806003193601126103a05781519181600192600154938460011c9160018616958615610396575b6020968785108114610383578899509688969785829a52918260001461035c575050600114610300575b50505061015292916102f1910385610793565b519282849384528301906106bb565b9190869350600183527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf65b82841061034457505050820101816102f16101526102de565b8054848a01860152889550879490930192810161032b565b60ff19168782015293151560051b860190930193508492506102f1915061015290506102de565b634e487b7160e01b835260228a52602483fd5b92607f16926102b4565b80fd5b8284346103a05760203660031901126103a0576001600160a01b036103c66106fb565b169283156103e35750806020938392526003845220549051908152f35b91516322718ad960e21b815291820152602490fd5b8284346103a05760203660031901126103a0575061041860209235610abf565b90516001600160a01b039091168152f35b505034610100576101dd9061043d3661072c565b9192519261044a84610761565b85845261096a565b83346103a0576101dd6104643661072c565b916107d1565b919050346101e057806003193601126101e0576104856106fb565b9160243561049281610abf565b33151580610534575b8061050b575b6104f5576001600160a01b039485169482918691167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258880a48452602052822080546001600160a01b031916909117905580f35b835163a9fbf51f60e01b81523381850152602490fd5b506001600160a01b03811686526005602090815284872033885290528386205460ff16156104a1565b506001600160a01b03811633141561049b565b9050346101e05760203660031901126101e05791826020933561056981610abf565b50825283528190205490516001600160a01b039091168152f35b8284346103a057806003193601126103a0578151918182549260018460011c9160018616958615610646575b6020968785108114610383578899509688969785829a52918260001461035c5750506001146105eb5750505061015292916102f1910385610793565b91908693508280527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5635b82841061062e57505050820101816102f16101526102de565b8054848a018601528895508794909301928101610615565b92607f16926105af565b8491346101e05760203660031901126101e0573563ffffffff60e01b81168091036101e057602092506380ac58cd60e01b81149081156106aa575b8115610699575b5015158152f35b6301ffc9a760e01b14905083610692565b635b5e139f60e01b8114915061068b565b919082519283825260005b8481106106e7575050826000602080949584010152601f8019910116010190565b6020818301810151848301820152016106c6565b600435906001600160a01b038216820361071157565b600080fd5b602435906001600160a01b038216820361071157565b6060906003190112610711576001600160a01b0390600435828116810361071157916024359081168103610711579060443590565b6020810190811067ffffffffffffffff82111761077d57604052565b634e487b7160e01b600052604160045260246000fd5b90601f8019910116810190811067ffffffffffffffff82111761077d57604052565b67ffffffffffffffff811161077d57601f01601f191660200190565b916001600160a01b03918216918215610951576000938285528260209460028652604095848789205416968791331515806108bb575b509060027fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef928461088c575b858c5260038152828c2080546001019055868c5252808a2080546001600160a01b03191685179055519880a41680830361086d5750505050565b6364283d7b60e01b845260048401526024830152604482015260649150fd5b868c5260048152828c2080546001600160a01b0319169055848c5260038152828c208054600019019055610833565b91939450915080610910575b156108d757859291879138610807565b5084866108f4576024915190637e27328960e01b82526004820152fd5b604491519063177e802f60e01b82523360048301526024820152fd5b503387148015610935575b806108c75750858852600481523385838a205416146108c7565b5086885260058152818820338952815260ff828920541661091b565b604051633250574960e11b815260006004820152602490fd5b9290926109788385836107d1565b833b610985575b50505050565b604051630a85bd0160e11b8082523360048301526001600160a01b03928316602483015260448201949094526080606482015294931692602092909185906109d19060848301906106bb565b039483816000978189895af1869181610a7b575b50610a46575050503d600014610a3d573d6109ff816107b5565b90610a0d6040519283610793565b81528093823d92013e5b82519283610a3857604051633250574960e11b815260048101849052602490fd5b019050fd5b60609250610a17565b919450915063ffffffff60e01b1603610a6357503880808061097f565b60249060405190633250574960e11b82526004820152fd5b9091508481813d8311610ab8575b610a938183610793565b81010312610ab457516001600160e01b031981168103610ab45790386109e5565b8680fd5b503d610a89565b6000818152600260205260409020546001600160a01b0316908115610ae2575090565b60249060405190637e27328960e01b82526004820152fdfea264697066735822122044235653b73457193b8d7b6102b48056d30e5fbb4bd4af7fe5e9f92b11d1c41c64736f6c63430008190033",
|
|
446
|
+
"deployedBytecode": "0x608060408181526004918236101561001657600080fd5b600092833560e01c91826301ffc9a7146106505750816306fdde0314610583578163081812fc14610547578163095ea7b31461046a57816323b872dd1461045257816342842e0e146104295781636352211e146103f857816370a08231146103a357816395d89b4114610286578163a22cb465146101e4578163b88d4fde14610156578163c87b56dd14610104575063e985e9c5146100b457600080fd5b3461010057806003193601126101005760ff816020936100d26106fb565b6100da610716565b6001600160a01b0391821683526005875283832091168252855220549151911615158152f35b5080fd5b838334610100576020366003190112610100576101246101529335610abf565b5081815161013181610761565b5280519161013e83610761565b8252519182916020835260208301906106bb565b0390f35b919050346101e05760803660031901126101e0576101726106fb565b61017a610716565b846064359467ffffffffffffffff8611610100573660238701121561010057850135946101b26101a9876107b5565b95519586610793565b858552366024878301011161010057856101dd9660246020930183880137850101526044359161096a565b80f35b8280fd5b919050346101e057806003193601126101e0576101ff6106fb565b9060243591821515809303610282576001600160a01b031692831561026d5750338452600560205280842083855260205280842060ff1981541660ff8416179055519081527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a380f35b836024925191630b61174360e31b8352820152fd5b8480fd5b8284346103a057806003193601126103a05781519181600192600154938460011c9160018616958615610396575b6020968785108114610383578899509688969785829a52918260001461035c575050600114610300575b50505061015292916102f1910385610793565b519282849384528301906106bb565b9190869350600183527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf65b82841061034457505050820101816102f16101526102de565b8054848a01860152889550879490930192810161032b565b60ff19168782015293151560051b860190930193508492506102f1915061015290506102de565b634e487b7160e01b835260228a52602483fd5b92607f16926102b4565b80fd5b8284346103a05760203660031901126103a0576001600160a01b036103c66106fb565b169283156103e35750806020938392526003845220549051908152f35b91516322718ad960e21b815291820152602490fd5b8284346103a05760203660031901126103a0575061041860209235610abf565b90516001600160a01b039091168152f35b505034610100576101dd9061043d3661072c565b9192519261044a84610761565b85845261096a565b83346103a0576101dd6104643661072c565b916107d1565b919050346101e057806003193601126101e0576104856106fb565b9160243561049281610abf565b33151580610534575b8061050b575b6104f5576001600160a01b039485169482918691167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258880a48452602052822080546001600160a01b031916909117905580f35b835163a9fbf51f60e01b81523381850152602490fd5b506001600160a01b03811686526005602090815284872033885290528386205460ff16156104a1565b506001600160a01b03811633141561049b565b9050346101e05760203660031901126101e05791826020933561056981610abf565b50825283528190205490516001600160a01b039091168152f35b8284346103a057806003193601126103a0578151918182549260018460011c9160018616958615610646575b6020968785108114610383578899509688969785829a52918260001461035c5750506001146105eb5750505061015292916102f1910385610793565b91908693508280527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5635b82841061062e57505050820101816102f16101526102de565b8054848a018601528895508794909301928101610615565b92607f16926105af565b8491346101e05760203660031901126101e0573563ffffffff60e01b81168091036101e057602092506380ac58cd60e01b81149081156106aa575b8115610699575b5015158152f35b6301ffc9a760e01b14905083610692565b635b5e139f60e01b8114915061068b565b919082519283825260005b8481106106e7575050826000602080949584010152601f8019910116010190565b6020818301810151848301820152016106c6565b600435906001600160a01b038216820361071157565b600080fd5b602435906001600160a01b038216820361071157565b6060906003190112610711576001600160a01b0390600435828116810361071157916024359081168103610711579060443590565b6020810190811067ffffffffffffffff82111761077d57604052565b634e487b7160e01b600052604160045260246000fd5b90601f8019910116810190811067ffffffffffffffff82111761077d57604052565b67ffffffffffffffff811161077d57601f01601f191660200190565b916001600160a01b03918216918215610951576000938285528260209460028652604095848789205416968791331515806108bb575b509060027fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef928461088c575b858c5260038152828c2080546001019055868c5252808a2080546001600160a01b03191685179055519880a41680830361086d5750505050565b6364283d7b60e01b845260048401526024830152604482015260649150fd5b868c5260048152828c2080546001600160a01b0319169055848c5260038152828c208054600019019055610833565b91939450915080610910575b156108d757859291879138610807565b5084866108f4576024915190637e27328960e01b82526004820152fd5b604491519063177e802f60e01b82523360048301526024820152fd5b503387148015610935575b806108c75750858852600481523385838a205416146108c7565b5086885260058152818820338952815260ff828920541661091b565b604051633250574960e11b815260006004820152602490fd5b9290926109788385836107d1565b833b610985575b50505050565b604051630a85bd0160e11b8082523360048301526001600160a01b03928316602483015260448201949094526080606482015294931692602092909185906109d19060848301906106bb565b039483816000978189895af1869181610a7b575b50610a46575050503d600014610a3d573d6109ff816107b5565b90610a0d6040519283610793565b81528093823d92013e5b82519283610a3857604051633250574960e11b815260048101849052602490fd5b019050fd5b60609250610a17565b919450915063ffffffff60e01b1603610a6357503880808061097f565b60249060405190633250574960e11b82526004820152fd5b9091508481813d8311610ab8575b610a938183610793565b81010312610ab457516001600160e01b031981168103610ab45790386109e5565b8680fd5b503d610a89565b6000818152600260205260409020546001600160a01b0316908115610ae2575090565b60249060405190637e27328960e01b82526004820152fdfea264697066735822122044235653b73457193b8d7b6102b48056d30e5fbb4bd4af7fe5e9f92b11d1c41c64736f6c63430008190033",
|
|
447
447
|
"linkReferences": {},
|
|
448
448
|
"deployedLinkReferences": {}
|
|
449
449
|
}
|
|
@@ -55,33 +55,33 @@ export const ERC1155Abi = ERC1155Artifact.abi;
|
|
|
55
55
|
// Make sure ContractName in ./types includes all of these keys.
|
|
56
56
|
export const ADDRESSES: AddressBook = {
|
|
57
57
|
// LiqETH contracts
|
|
58
|
-
LiqEthAuthority: "
|
|
59
|
-
BeaconState: "
|
|
60
|
-
WithdrawalQueue: "
|
|
61
|
-
LiqEthToken: "
|
|
62
|
-
Accounting: "
|
|
63
|
-
DepositManager: "
|
|
64
|
-
WithdrawalVault: "
|
|
65
|
-
StakingModule: "
|
|
66
|
-
YieldOracle: "
|
|
58
|
+
LiqEthAuthority: "0x3Eb66Bb91F7a022FbABc1619Cb6acce7025Bc41F",
|
|
59
|
+
BeaconState: "0x08F879c6D0964E0A17bF688Af23168f654DF372e",
|
|
60
|
+
WithdrawalQueue: "0x74aDeD940369baDDb0F36426F23B08499e45Fe18",
|
|
61
|
+
LiqEthToken: "0x8C974517D038e2e3b8a1da7b1A026bC8132A4b2e",
|
|
62
|
+
Accounting: "0x766CE996B8132b927988c5b2ECAE8108fB1a9307",
|
|
63
|
+
DepositManager: "0xEd391dB5DB11B5eDBE08e69A51D16e84293C09a3",
|
|
64
|
+
WithdrawalVault: "0xbaBc0D5997283ab9886696A0dEaB8A8093436b48",
|
|
65
|
+
StakingModule: "0x4998fBb6Ca5Ee3Db6c339e2962A34791Af643fEa",
|
|
66
|
+
YieldOracle: "0x61Fe311C57dd9a38Fb7B0c5A8ec521452dB25378",
|
|
67
67
|
|
|
68
68
|
//Outpost contracts
|
|
69
|
-
OutpostManagerAuthority: "
|
|
70
|
-
iodata: "
|
|
71
|
-
Base58: "
|
|
72
|
-
sysio_merkle: "
|
|
73
|
-
ReceiptNFT: "
|
|
69
|
+
OutpostManagerAuthority: "0x3B8705Ba1195AF632b3bd9E46F19348BC828FA3D",
|
|
70
|
+
iodata: "0x4aCABbC74a1cA9B0058d9ADAa0E00Af0f4f73212",
|
|
71
|
+
Base58: "0x1241F36ff30065deD52d51f0d6524EF971259A12",
|
|
72
|
+
sysio_merkle: "0x58ca9b5515266Fd6bF94D5F1268C505b2eC9679c",
|
|
73
|
+
ReceiptNFT: "0x03d6bD46cA9F54B8F8bbA21CfAfe717b36cB8593",
|
|
74
|
+
EthUsdPriceConsumer: "0xdC2DD993A13b3DD6D255B52285625694bd967c9A",
|
|
75
|
+
Pool: "0xd4742757AA61B1Fd3Fcd87980D7D460B12Cd9275",
|
|
76
|
+
OutpostManager: "0x38ec2B56cBCeCaFFe28b535517de1a102C3D74E3",
|
|
77
|
+
sysio_write: "0x0Ec4C1BaB772958aa3Db27459643bfbE7d92E305",
|
|
78
|
+
Pretoken: "0x8c97a51A71640fa411DEfab8feC3401eFfd1a2E4",
|
|
79
|
+
BAR: "0xbAFac13ffd3Aa9aEabaaeb6e4C2cF3dFf3479DC0",
|
|
80
|
+
OPPCommon: "0x12283a6d4E6cE4A0e8AdB319Fc161c7F4f91EA8F",
|
|
81
|
+
OPP: "0x87CE3Fe2CDca39C04aa2c14bbF1E1d9DB6358C4A",
|
|
82
|
+
Depositor: "0x5351B30EA4b75bD9be9Fc0048e88F675f7b3Ac2b",
|
|
83
|
+
OPPInbound: "0x0B1f7FB1c7f01A9cf490a1387E1E100F2bEA6C6d",
|
|
74
84
|
MockAggregator: "0xFCfc3ddd4CBd9Ad3b3af3A374B8bdA1b66eE6FFF",
|
|
75
|
-
Pool: "0xee5F11aC9b104c18d2423f266c5E737fC95ebA92",
|
|
76
|
-
OutpostManager: "0xB1B6ba7FA156652849069aC7ADB281283D235B9f",
|
|
77
|
-
sysio_write: "0xEfA608136d372349C09a7aA57665C09Fb4a620Ca",
|
|
78
|
-
EthUsdPriceConsumer: "0x6337A23b61f98b1526faF2848385Abe9cB4cFF21",
|
|
79
|
-
BAR: "0x9264eAA449da94caF70Fc18522021a94C8DF32Fb",
|
|
80
|
-
OPPCommon: "0x86A8cA16ce521De3EBdd1C541fAf188795b59FD0",
|
|
81
|
-
OPP: "0x79e8395Bb5131FB285aCEE5329BB43E66f50F88C",
|
|
82
|
-
Pretoken: "0x62f98AF2f9C3EF4eF2fA7bc0245BD5a9315E7541",
|
|
83
|
-
OPPInbound: "0xC85f57Ff069711e0b3472De3963bd2fC2FEfF3e2",
|
|
84
|
-
Depositor: "0xb0BACAb6f13dd96281300be13a6346461b2f35F3"
|
|
85
85
|
};
|
|
86
86
|
|
|
87
87
|
export type Contracts<T extends string = ContractName> = Record<T, ContractConfig>;
|
|
@@ -142,7 +142,10 @@ export class EthereumStakingClient implements IStakingClient {
|
|
|
142
142
|
const buyer = await this.signer!.getAddress();
|
|
143
143
|
|
|
144
144
|
// ! Hoodi only - check if the mock aggregator price is stale, and if so, update it before submitting the buy request
|
|
145
|
-
await this.
|
|
145
|
+
const network = await this.provider.getNetwork();
|
|
146
|
+
const chainId = network.chainId;
|
|
147
|
+
const allowedTestChains = new Set([560048]);
|
|
148
|
+
if (allowedTestChains.has(chainId)) await this.updateMockAggregatorPrice();
|
|
146
149
|
|
|
147
150
|
let result = await this.pretokenClient.purchasePretokensWithLiqETH(amount, buyer);
|
|
148
151
|
return result && result.txHash ? result.txHash : "Error - no resulting txHash";
|
|
@@ -349,7 +352,7 @@ export class EthereumStakingClient implements IStakingClient {
|
|
|
349
352
|
|
|
350
353
|
|
|
351
354
|
// Fetch all required contract data
|
|
352
|
-
const [totalSharesBn, indexBn, trancheNumberBn, trancheSupplyBn,
|
|
355
|
+
const [totalSharesBn, indexBn, trancheNumberBn, trancheSupplyBn, tranchePriceUsdBn, totalSupplyBn, supplyGrowthBps, priceGrowthCents, minPriceUsd, maxPriceUsd] = await Promise.all([
|
|
353
356
|
this.contract.Depositor.totalShares(blockTag),
|
|
354
357
|
this.contract.Depositor.index(blockTag),
|
|
355
358
|
this.contract.Pretoken.trancheNumber(blockTag),
|
|
@@ -362,14 +365,18 @@ export class EthereumStakingClient implements IStakingClient {
|
|
|
362
365
|
this.contract.EthUsdPriceConsumer.MAX_PRICE(),
|
|
363
366
|
]);
|
|
364
367
|
|
|
365
|
-
|
|
366
368
|
const totalTrancheSupply = BigInt(totalSupplyBn.toString()) / BigInt(1e10);
|
|
367
369
|
const currentTrancheSupply = BigInt(trancheSupplyBn.toString()) / BigInt(1e10);
|
|
368
370
|
|
|
369
371
|
|
|
370
372
|
// fetch price and timestamp from aggregator
|
|
371
373
|
const [roundId, answer, startedAt, updatedAt, answeredInRound] = await this.contract.MockAggregator.latestRoundData();
|
|
372
|
-
|
|
374
|
+
//originally fetched ethPrice from aggregator - pulling from EthUsdPriceConsumer instead - this is where the actual price gets pulled from when purchasing pretokens.
|
|
375
|
+
// let ethPriceUsd: bigint = BigInt(answer.toString());)
|
|
376
|
+
|
|
377
|
+
let ethPriceUsdBn = await this.contract.EthUsdPriceConsumer.getPrice18Decimals();
|
|
378
|
+
let ethPriceUsd: bigint = BigInt(ethPriceUsdBn.toString()) / 10n;
|
|
379
|
+
|
|
373
380
|
let nativePriceTimestamp: number = Number(updatedAt);
|
|
374
381
|
|
|
375
382
|
const initialTrancheSupply = BigInt(INITIAL_TRANCHE_SUPPLY) * BigInt(1e8);
|
|
@@ -380,7 +387,7 @@ export class EthereumStakingClient implements IStakingClient {
|
|
|
380
387
|
indexBn,
|
|
381
388
|
trancheNumberBn,
|
|
382
389
|
currentTrancheSupply,
|
|
383
|
-
|
|
390
|
+
tranchePriceUsdBn,
|
|
384
391
|
totalTrancheSupply,
|
|
385
392
|
initialTrancheSupply,
|
|
386
393
|
supplyGrowthBps,
|
|
@@ -395,8 +402,6 @@ export class EthereumStakingClient implements IStakingClient {
|
|
|
395
402
|
});
|
|
396
403
|
}
|
|
397
404
|
catch (err: any) {
|
|
398
|
-
console.log(err);
|
|
399
|
-
|
|
400
405
|
throw new Error(`Error fetching Ethereum tranche snapshot: ${err?.message || err}`);
|
|
401
406
|
}
|
|
402
407
|
}
|
|
@@ -413,10 +418,11 @@ export class EthereumStakingClient implements IStakingClient {
|
|
|
413
418
|
* @param options.safetyMultiplier Additional safety multiplier on top of txCount (default 1.5x)
|
|
414
419
|
* @param options.minBufferWei Optional override minimum buffer (defaults ~0.002 ETH)
|
|
415
420
|
*/
|
|
416
|
-
async
|
|
421
|
+
async getDepositBuffer(options?: {
|
|
417
422
|
txCount?: number;
|
|
418
423
|
safetyMultiplier?: number;
|
|
419
424
|
minBufferWei?: bigint;
|
|
425
|
+
balanceOverrideLamports?: bigint;
|
|
420
426
|
}): Promise<bigint> {
|
|
421
427
|
this.ensureUser();
|
|
422
428
|
|
|
@@ -111,53 +111,57 @@ export async function sendOPPFinalize(opp: ethers.Contract, gasLimit?: ethers.Bi
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
|
|
114
|
+
const BPS_DENOM = BigInt(10_000);
|
|
114
115
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
116
|
+
// On-chain USD: 1e18 (wei-style)
|
|
117
|
+
const USD_ONCHAIN_SCALE = BigInt(1_000_000_000_000_000_000); // 1e18
|
|
118
|
+
// Client snapshot USD: 1e8 (to match fromScale8)
|
|
119
|
+
const USD_CLIENT_SCALE = BigInt(100_000_000); // 1e8
|
|
120
|
+
// Factor to go from 1e18 → 1e8
|
|
121
|
+
const USD_SCALE_DOWN = USD_ONCHAIN_SCALE / USD_CLIENT_SCALE; // 1e10
|
|
122
|
+
|
|
123
|
+
/** 2.5% growth in BPS for supply side */
|
|
124
|
+
function growSupplyOnce(value: bigint, growthBps: number): bigint {
|
|
120
125
|
const g = BigInt(growthBps);
|
|
121
|
-
return (value * (
|
|
126
|
+
return (value * (BPS_DENOM + g)) / BPS_DENOM;
|
|
122
127
|
}
|
|
123
128
|
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Apply one backward step: value * BPS / (BPS + growthBps).
|
|
127
|
-
* Also integer round-half-up.
|
|
128
|
-
*/
|
|
129
|
-
function shrinkOnce(value: bigint, growthBps: number): bigint {
|
|
129
|
+
function shrinkSupplyOnce(value: bigint, growthBps: number): bigint {
|
|
130
130
|
const g = BigInt(growthBps);
|
|
131
|
-
return (value *
|
|
131
|
+
return (value * BPS_DENOM) / (BPS_DENOM + g);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
/** Linear USD price step in on-chain 1e18 scale */
|
|
135
|
+
function growPriceOnceUsd1e18(value: bigint, stepUsd1e18: bigint): bigint {
|
|
136
|
+
return value + stepUsd1e18;
|
|
137
|
+
}
|
|
134
138
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
*/
|
|
139
|
-
function getTrancheSize(startSupply: bigint, supplyGrowthBps: number, trancheNumber: number): bigint {
|
|
140
|
-
let supply = startSupply;
|
|
141
|
-
for (let i = 0; i < trancheNumber; i++) {
|
|
142
|
-
supply = (supply * (BPS + BigInt(supplyGrowthBps)) + BPS / BigInt(2)) / BPS;
|
|
143
|
-
}
|
|
144
|
-
return supply;
|
|
139
|
+
function shrinkPriceOnceUsd1e18(value: bigint, stepUsd1e18: bigint): bigint {
|
|
140
|
+
if (value <= stepUsd1e18) return BigInt(0);
|
|
141
|
+
return value - stepUsd1e18;
|
|
145
142
|
}
|
|
146
143
|
|
|
144
|
+
/** Convert on-chain 1e18 USD to client 1e8 USD */
|
|
145
|
+
function usd1e18To1e8(raw: bigint): bigint {
|
|
146
|
+
// 1e18 / 1e8 = 1e10 factor difference
|
|
147
|
+
return raw / USD_SCALE_DOWN;
|
|
148
|
+
}
|
|
147
149
|
|
|
148
150
|
/**
|
|
149
|
-
* Build a local tranche ladder around the current tranche
|
|
150
|
-
* using only on-chain config + current state.
|
|
151
|
+
* Build a local tranche ladder around the current tranche.
|
|
151
152
|
*
|
|
153
|
+
* Inside this function:
|
|
154
|
+
* - `currentPriceUsd` and `priceGrowthCents` are treated as 1e18-scaled USD.
|
|
155
|
+
* - Output `priceUsd` is 1e8-scaled USD (for fromScale8()).
|
|
152
156
|
*/
|
|
153
157
|
export function buildEthereumTrancheLadder(options: {
|
|
154
158
|
currentTranche: number;
|
|
155
|
-
totalTrancheSupply: bigint,
|
|
159
|
+
totalTrancheSupply: bigint; // not used in local window, but kept for API parity
|
|
156
160
|
initialTrancheSupply: bigint;
|
|
157
|
-
currentTrancheSupply: bigint;
|
|
158
|
-
currentPriceUsd: bigint;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
+
currentTrancheSupply: bigint; // remaining in current tranche (1e8 scale)
|
|
162
|
+
currentPriceUsd: bigint; // 1e18 scale
|
|
163
|
+
priceGrowthCents: bigint; // 1e18 step, e.g. $0.02 → 2e16
|
|
164
|
+
supplyGrowthBps: number; // 250 = 2.5%
|
|
161
165
|
windowBefore?: number;
|
|
162
166
|
windowAfter?: number;
|
|
163
167
|
}): TrancheLadderItem[] {
|
|
@@ -166,44 +170,50 @@ export function buildEthereumTrancheLadder(options: {
|
|
|
166
170
|
initialTrancheSupply,
|
|
167
171
|
currentTrancheSupply,
|
|
168
172
|
currentPriceUsd,
|
|
169
|
-
supplyGrowthBps,
|
|
170
173
|
priceGrowthCents,
|
|
174
|
+
supplyGrowthBps,
|
|
171
175
|
windowBefore = 5,
|
|
172
176
|
windowAfter = 5,
|
|
173
177
|
} = options;
|
|
174
178
|
|
|
175
179
|
const startId = Math.max(0, currentTranche - windowBefore);
|
|
176
180
|
const endId = currentTranche + windowAfter;
|
|
177
|
-
|
|
178
|
-
//calculate total tranche size (e.g. 60,600 on tranche 2)
|
|
179
|
-
const currentTrancheSize = getTrancheSize(initialTrancheSupply, supplyGrowthBps, currentTranche);
|
|
180
181
|
|
|
181
|
-
const capacity = new Map<number, bigint>();
|
|
182
|
-
const
|
|
182
|
+
const capacity = new Map<number, bigint>(); // 1e8 pre-token units
|
|
183
|
+
const priceUsd = new Map<number, bigint>(); // 1e18 USD
|
|
184
|
+
|
|
185
|
+
// Capacity at the current tranche derived from initial supply & BPS growth
|
|
186
|
+
let currentCap = initialTrancheSupply;
|
|
187
|
+
for (let i = 0; i < currentTranche; i++) {
|
|
188
|
+
currentCap = growSupplyOnce(currentCap, supplyGrowthBps);
|
|
189
|
+
}
|
|
183
190
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
price.set(currentTranche, currentPriceUsd);
|
|
191
|
+
capacity.set(currentTranche, currentCap);
|
|
192
|
+
priceUsd.set(currentTranche, currentPriceUsd);
|
|
187
193
|
|
|
188
194
|
// Forward (future tranches)
|
|
189
195
|
for (let id = currentTranche + 1; id <= endId; id++) {
|
|
190
196
|
const prevCap = capacity.get(id - 1)!;
|
|
191
|
-
const prevPrice =
|
|
192
|
-
|
|
193
|
-
|
|
197
|
+
const prevPrice = priceUsd.get(id - 1)!;
|
|
198
|
+
|
|
199
|
+
capacity.set(id, growSupplyOnce(prevCap, supplyGrowthBps));
|
|
200
|
+
priceUsd.set(id, growPriceOnceUsd1e18(prevPrice, priceGrowthCents));
|
|
194
201
|
}
|
|
195
202
|
|
|
196
203
|
// Backward (past tranches)
|
|
197
204
|
for (let id = currentTranche - 1; id >= startId; id--) {
|
|
198
205
|
const nextCap = capacity.get(id + 1)!;
|
|
199
|
-
const nextPrice =
|
|
200
|
-
|
|
201
|
-
|
|
206
|
+
const nextPrice = priceUsd.get(id + 1)!;
|
|
207
|
+
|
|
208
|
+
capacity.set(id, shrinkSupplyOnce(nextCap, supplyGrowthBps));
|
|
209
|
+
priceUsd.set(id, shrinkPriceOnceUsd1e18(nextPrice, priceGrowthCents));
|
|
202
210
|
}
|
|
203
211
|
|
|
212
|
+
// Build ladder view
|
|
204
213
|
const ladder: TrancheLadderItem[] = [];
|
|
205
214
|
for (let id = startId; id <= endId; id++) {
|
|
206
215
|
const cap = capacity.get(id)!;
|
|
216
|
+
|
|
207
217
|
let sold: bigint;
|
|
208
218
|
if (id < currentTranche) {
|
|
209
219
|
sold = cap;
|
|
@@ -213,19 +223,21 @@ export function buildEthereumTrancheLadder(options: {
|
|
|
213
223
|
sold = BigInt(0);
|
|
214
224
|
}
|
|
215
225
|
|
|
226
|
+
const remaining = cap - sold;
|
|
227
|
+
const priceClientScale = usd1e18To1e8(priceUsd.get(id)!); // 1e8
|
|
228
|
+
|
|
216
229
|
ladder.push({
|
|
217
230
|
id,
|
|
218
231
|
capacity: cap,
|
|
219
232
|
sold,
|
|
220
|
-
remaining
|
|
221
|
-
priceUsd:
|
|
233
|
+
remaining,
|
|
234
|
+
priceUsd: priceClientScale,
|
|
222
235
|
});
|
|
223
236
|
}
|
|
224
237
|
|
|
225
238
|
return ladder;
|
|
226
239
|
}
|
|
227
240
|
|
|
228
|
-
|
|
229
241
|
/**
|
|
230
242
|
* Turn raw liqsol_core accounts into a chain-agnostic TrancheSnapshot for SOL.
|
|
231
243
|
* All math stays here; TokenClient just wires accounts + connection.
|
|
@@ -236,11 +248,11 @@ export async function buildEthereumTrancheSnapshot(options: {
|
|
|
236
248
|
indexBn;
|
|
237
249
|
trancheNumberBn;
|
|
238
250
|
currentTrancheSupply;
|
|
239
|
-
|
|
251
|
+
tranchePriceUsdBn;
|
|
240
252
|
totalTrancheSupply;
|
|
241
253
|
initialTrancheSupply;
|
|
242
254
|
supplyGrowthBps;
|
|
243
|
-
priceGrowthCents;
|
|
255
|
+
priceGrowthCents; // BigNumber from contract (1e18 for $0.02)
|
|
244
256
|
minPriceUsd;
|
|
245
257
|
maxPriceUsd;
|
|
246
258
|
|
|
@@ -256,53 +268,73 @@ export async function buildEthereumTrancheSnapshot(options: {
|
|
|
256
268
|
ladderWindowBefore,
|
|
257
269
|
ladderWindowAfter,
|
|
258
270
|
|
|
259
|
-
totalSharesBn,
|
|
260
|
-
indexBn,
|
|
261
|
-
trancheNumberBn,
|
|
262
|
-
currentTrancheSupply,
|
|
263
|
-
|
|
271
|
+
totalSharesBn,
|
|
272
|
+
indexBn,
|
|
273
|
+
trancheNumberBn,
|
|
274
|
+
currentTrancheSupply,
|
|
275
|
+
tranchePriceUsdBn,
|
|
264
276
|
totalTrancheSupply,
|
|
265
277
|
initialTrancheSupply,
|
|
266
278
|
supplyGrowthBps,
|
|
267
279
|
priceGrowthCents,
|
|
268
|
-
minPriceUsd,
|
|
280
|
+
minPriceUsd,
|
|
269
281
|
maxPriceUsd,
|
|
270
282
|
} = options;
|
|
271
283
|
|
|
284
|
+
// ---- BigNumber -> bigint conversions ----
|
|
285
|
+
|
|
286
|
+
// Shares: keep your prior behaviour (1e8 scale) via /1e10
|
|
287
|
+
const totalShares = BigInt(totalSharesBn.toString()) / BigInt(10_000_000_000); // 1e10
|
|
272
288
|
|
|
273
|
-
// convert default BigNumber to bigint for hub to handle, and partially convert from 1e18 to 1e8 for the hub
|
|
274
|
-
const totalShares = BigInt(totalSharesBn.toString()) / BigInt(1e10);
|
|
275
289
|
const currentIndex = BigInt(indexBn.toString()); // RAY (1e27)
|
|
290
|
+
|
|
276
291
|
const currentTranche = Number(trancheNumberBn.toString());
|
|
277
|
-
const currentPriceUsd = BigInt(tranchePriceWadBn.toString()) / BigInt(1e10); // 1e18 WAD
|
|
278
292
|
|
|
293
|
+
// Prices & step in 1e18 scale from contract
|
|
294
|
+
const currentPriceUsd1e18 = BigInt(tranchePriceUsdBn.toString());
|
|
295
|
+
const priceGrowthStepUsd1e18 = BigInt(priceGrowthCents.toString());
|
|
296
|
+
|
|
297
|
+
// Convert price step to “cents” number for snapshot:
|
|
298
|
+
// 1 USD = 1e18 → 1 cent = 1e16.
|
|
299
|
+
const priceGrowthCentsNumber = Number(
|
|
300
|
+
priceGrowthStepUsd1e18 / BigInt(10_000_000_000_000_000) // 1e16
|
|
301
|
+
);
|
|
302
|
+
|
|
303
|
+
// Pre-token supplies (already 1e8-ish scale on-chain)
|
|
304
|
+
const currentTrancheSupplyBig = BigInt(currentTrancheSupply.toString());
|
|
305
|
+
const totalTrancheSupplyBig = BigInt(totalTrancheSupply.toString());
|
|
306
|
+
const initialTrancheSupplyBig = BigInt(initialTrancheSupply.toString());
|
|
307
|
+
|
|
308
|
+
// UI-current price (1e8 scale)
|
|
309
|
+
const currentPriceUsd = currentPriceUsd1e18 / BigInt(10_000_000_000); // 1e10
|
|
310
|
+
|
|
311
|
+
// ---- Build ladder ----
|
|
279
312
|
|
|
280
313
|
const ladder = buildEthereumTrancheLadder({
|
|
281
314
|
currentTranche,
|
|
282
|
-
totalTrancheSupply,
|
|
283
|
-
initialTrancheSupply,
|
|
284
|
-
currentTrancheSupply,
|
|
285
|
-
currentPriceUsd,
|
|
315
|
+
totalTrancheSupply: totalTrancheSupplyBig,
|
|
316
|
+
initialTrancheSupply: initialTrancheSupplyBig,
|
|
317
|
+
currentTrancheSupply: currentTrancheSupplyBig,
|
|
318
|
+
currentPriceUsd: currentPriceUsd1e18, // 1e18
|
|
319
|
+
priceGrowthCents: priceGrowthStepUsd1e18, // 1e18 step
|
|
286
320
|
supplyGrowthBps,
|
|
287
|
-
priceGrowthCents,
|
|
288
321
|
windowBefore: ladderWindowBefore,
|
|
289
322
|
windowAfter: ladderWindowAfter,
|
|
290
323
|
});
|
|
291
324
|
|
|
292
|
-
|
|
293
325
|
return {
|
|
294
326
|
chainID,
|
|
295
327
|
currentIndex,
|
|
296
328
|
totalShares,
|
|
297
329
|
currentTranche,
|
|
298
|
-
currentPriceUsd,
|
|
330
|
+
currentPriceUsd, // 1e8
|
|
299
331
|
supplyGrowthBps,
|
|
300
|
-
priceGrowthCents,
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
332
|
+
priceGrowthCents: priceGrowthCentsNumber, // <-- number as required
|
|
333
|
+
totalPretokensSold: totalTrancheSupplyBig,
|
|
334
|
+
currentTrancheSupply: currentTrancheSupplyBig,
|
|
335
|
+
initialTrancheSupply: initialTrancheSupplyBig,
|
|
304
336
|
nativePriceUsd: ethPriceUsd,
|
|
305
337
|
nativePriceTimestamp,
|
|
306
338
|
ladder,
|
|
307
339
|
};
|
|
308
|
-
}
|
|
340
|
+
}
|