###### tags: `SAIGATE` # 11/5ver 開発内容 11月段階のブロックチェーン連携版のアプリケーションをFunPlus社に共有するにあたって、SAINの当初の設計と今回の設計のズレ、及び対応に関する草案のまとめ。 ## 現状仕様の整理 ### コントラクト呼び出しが、管理者アカウントになってしまう点 一旦そのままでFunPlusさんに共有。 GASの説明の資料で詳細については説明予定。 ### オークション形式にオープンシーPolygon版は対応していないので、オークションのフローを変えないといけない。 現状として、OpenseaではEthereum、Polygonバージョンともに同一のトランスファーのコントラクトを使用している。今回参考にするPolygonバージョンについては呼び出しが運営者となっているため、**データベースの情報をコントラクトに引数として渡す必要がある。** ## 今後の開発にあたって ### 参考コントラクト https://polygonscan.com/address/0xf715beb51ec8f63317d66f491e37e7bb048fcc2d#code ### 挙動概要 1. 出品者が商品の作成と出品を行う。(見せかけのMINT部分) 2. 購入者が商品に対して、購入申請を行う。 →この時点でもコントラクトは発生せず、購入内容がDB上に渡るのみ。 1. 管理者アドレス(OpenSeaのもの)(https://polygonscan.com/address/0x9b814233894cd227f561b78cc65891aa55c62ad2 )より、コントラクトの呼び出しを行う。 2. UI上はTransferとSaleが別のアクションとして表記されるが、リンク付けされているトランザクションは同一。(GASもコントラクト一回分) ### 開発が必要だと思われる点 1. 公式アカウントでトランザクションを呼び出す際にDBからコントラクトに引数を渡す機能。これは通常の販売でもオークション形式でも運営者が呼び出すばあいには同じ情報で良いと思っています。(早川さん) 2. 上記の挙動になった際に、UI上で想定と違うものがあれば調整。(吉井さんor糸長さん) →もしかしたらオークション終了後にオークションに勝利しました。確定します。みたいな画面があってもいいかも?これは勝利した時点で確定であればそのユーザー情報をそのままコントラクトに投げるでも問題ない。 4. MetaMaskから情報を持ってくる必要があれば、(初回のログインとは別に)その情報を持ってくるためのMetaMaskAPIの連携(上田) ### コントラクトが必要としている変数(DBから投げて欲しい情報) #### Orderで使用する基本情報 ``` struct Order { address makerAddress; // Address that created the order. address takerAddress; // Address that is allowed to fill the order. If set to 0, any address is allowed to fill the order. address feeRecipientAddress; // Address that will recieve fees when order is filled. address senderAddress; // Address that is allowed to call Exchange contract methods that affect this order. If set to 0, any address is allowed to call these methods. uint256 makerAssetAmount; // Amount of makerAsset being offered by maker. Must be greater than 0. uint256 takerAssetAmount; // Amount of takerAsset being bid on by maker. Must be greater than 0. uint256 makerFee; // Fee paid to feeRecipient by maker when order is filled. uint256 takerFee; // Fee paid to feeRecipient by taker when order is filled. uint256 expirationTimeSeconds; // Timestamp in seconds at which order expires. uint256 salt; // Arbitrary number to facilitate uniqueness of the order's hash. bytes makerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring makerAsset. The leading bytes4 references the id of the asset proxy. bytes takerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring takerAsset. The leading bytes4 references the id of the asset proxy. bytes makerFeeAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring makerFeeAsset. The leading bytes4 references the id of the asset proxy. bytes takerFeeAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring takerFeeAsset. The leading bytes4 references the id of the asset proxy. } ```